Check if the command line developer tools are installed? (M2 MacBook Air macOS Ventura)

Hello, I have installed the command line developer tools after typing in the command "git" in the terminal. I would just like to make sure the installation went well and there are no issues. How would I make sure the command line developer tools were installed correctly on my M2 Macbook Air on macOS Ventura?

MacBook Air, macOS 13.2

Posted on Feb 13, 2023 12:05 PM

Reply
Question marked as Top-ranking reply

Posted on Feb 14, 2023 10:29 AM

The following shell script will get the version and install date of the last installed CommandLineTools. It will flag you in red if they are not installed, or print the version and date of last installation.


#!/bin/zsh

CLTEST="/Library/Developer/CommandLineTools/SDKs"
RED="\033[00;38;5;196m"

[[ -d ${CLTEST} ]] || {echo "${RED}CommandLineTools are not installed."; exit 1}

CLVERSION=$(pkgutil --pkg-info $(pkgutil --pkgs | grep CLTools | head -n 1) | \
            awk '/version:/ {print $2}')
CLDATE=$(pkgutil --pkg-info $(pkgutil --pkgs | grep CLTools | head -n 1) | \
            awk '/install-time:/ {print $2}')


printf 'Version:      %s\nInstall Date: %s\n' ${CLVERSION:0:6} "$(date -j -r ${CLDATE} +"%F %T")"
exit 0


Output:




7 replies
Question marked as Top-ranking reply

Feb 14, 2023 10:29 AM in response to dripz_XD

The following shell script will get the version and install date of the last installed CommandLineTools. It will flag you in red if they are not installed, or print the version and date of last installation.


#!/bin/zsh

CLTEST="/Library/Developer/CommandLineTools/SDKs"
RED="\033[00;38;5;196m"

[[ -d ${CLTEST} ]] || {echo "${RED}CommandLineTools are not installed."; exit 1}

CLVERSION=$(pkgutil --pkg-info $(pkgutil --pkgs | grep CLTools | head -n 1) | \
            awk '/version:/ {print $2}')
CLDATE=$(pkgutil --pkg-info $(pkgutil --pkgs | grep CLTools | head -n 1) | \
            awk '/install-time:/ {print $2}')


printf 'Version:      %s\nInstall Date: %s\n' ${CLVERSION:0:6} "$(date -j -r ${CLDATE} +"%F %T")"
exit 0


Output:




Feb 13, 2023 5:35 PM in response to dripz_XD

dripz_XD wrote:

What command would I need to find the location of the command line developer tools?


When an Xcode tools version is selected, the tools will be in the path.


To see the Xcode tools directory currently in use (there can be multiple versions installed) use:


xcode-select —-print-path


Given what could be inferred as some unfamiliarity with UNIX shells and tooling, maybe provide a little more background on the particular overarching concern, or on the issue or error being encountered, too?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Check if the command line developer tools are installed? (M2 MacBook Air macOS Ventura)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.