See Yosemite Update.
See Yosemite Update.
See Yosemite Update.
See Yosemite Update.
See Yosemite Update.
Just enter in gcc
or make
on the command line! OSX will know that you do not have the command line tools and prompt you to install them!
To check if they exist, xcode-select -p
will print the directory. Alternatively, the return value will be 2
if they do NOT exist, and 0
if they do. To just print the return value (thanks @Andy):
xcode-select -p 1>/dev/null;echo $?
Use pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
Option 1: Rob Napier suggested to use pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI
, which is probably cleaner.
Option 2: Check inside /var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
for a reference to com.apple.pkg.DeveloperToolsCLI
and it will list the version 4.5.0
.
[Mar 12 17:04] [jnovack@yourmom ~]$ defaults read /var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
{
InstallDate = "2012-12-26 22:45:54 +0000";
InstallPrefixPath = "/";
InstallProcessName = Xcode;
PackageFileName = "DeveloperToolsCLI.pkg";
PackageGroups = (
"com.apple.FindSystemFiles.pkg-group",
"com.apple.DevToolsBoth.pkg-group",
"com.apple.DevToolsNonRelocatableShared.pkg-group"
);
PackageIdentifier = "com.apple.pkg.DeveloperToolsCLI";
PackageVersion = "4.5.0.0.1.1249367152";
PathACLs = {
Library = "!#acl 1\\ngroup:ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C:everyone:12:deny:delete\\n";
System = "!#acl 1\\ngroup:ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C:everyone:12:deny:delete\\n";
};
}
Below are a few extra steps on a fresh Mac that some people might need. This adds a little to @jnovack's excellent answer.
Update: A few other notes when setting this up:
Make sure your admin user has a password. A blank password won't work when trying to enable a root user.
System Preferences > Users and Groups > (select user) > Change password
Then to enable root, run dsenableroot
in a terminal:
$ dsenableroot
username = mac_admin_user
user password:
root password:
verify root password:
dsenableroot:: ***Successfully enabled root user.
Type in the admin user's password, then the new enabled root password twice.
Next type:
sudo gcc
or
sudo make
It will respond with something like the following:
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
You have not agreed to the Xcode license agreements. You must agree to
both license agreements below in order to use Xcode.
Press enter when it prompts to show you the license agreement.
Hit the Enter key to view the license agreements at
'/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
IMPORTANT: BY USING THIS SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE
FOLLOWING APPLE TERMS:
//...
Press q
to exit the license agreement view.
By typing 'agree' you are agreeing to the terms of the software license
agreements. Type 'print' to print them or anything else to cancel,
[agree, print, cancel]
Type agree
. And then it will end with:
clang: error: no input files
Which basically means that you didn't give make
or gcc
any input files.
Here is what the check looked like:
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
With Mavericks, it is a little different now.
When the tools were NOT found, this is what the command pkgutil
command returned:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
To install the command line tools, this works nicely from the Terminal, with a nice gui and everything.
$ xcode-select --install
http://macops.ca/installing-command-line-tools-automatically-on-mavericks/
When they were found, this is what the pkgutil
command returned:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 5.0.1.0.1.1382131676
volume: /
location: /
install-time: 1384149984
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group
This command returned the same before and after the install.
$ pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
Also I had the component for the CLT selected and installed in xcode's downloads section before, but it seems like it didn't make it to the terminal...
Hope that helps.
To check if command line tools are installed run:
xcode-select --version
// if installed you will see the below with the version found in your system
// xcode-select version 1234.
If command line tools are not installed run:
xcode-select --install
On macOS Sierra (10.12) :
Run the following command to see if CLT is installed:
xcode-select -p
this will return the path to the tool if CLT is already installed. Something like this -
/Applications/Xcode.app/Contents/Developer
Run the following command to see the version of CLT:
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
this will return version info, output will be something like this -
package-id: com.apple.pkg.CLTools_Executables
version: 8.2.0.0.1.1480973914
volume: /
location: /
install-time: 1486372375
In macOS Catalina, and possibly some earlier versions, you can find out where the command line tools are installed using:
xcode-select -p
a.k.a. xcode-select --print-path
Which will, if it is installed, respond with something like:
/Library/Developer/CommandLineTools
To find out which version you have installed there, you can use:
xcode-select -v
a.k.a. xcode-select --version
Which will return something like:
xcode-select version 2370.
However, if you attempt to upgrade it to the latest version, assuming it is installed, using this:
xcode-select --install
You will receive in response:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Which rather erroneously gives the impression you need to use Spotlight find something called 'Software Update'. In actual fact, you need to continue in the Terminal, and use this:
softwareupdate -i -a
a.k.a. softwareupdate --install --all
Which tries to update everything it can and may well respond with:
Software Update Tool
Finding available software
No new software available.
To find out which versions of the different Apple SDKs are installed on your machine, use this:
xcodebuild -showsdks
I think the simplest way which worked for me to find Command line tools is installed or not and its version irrespective of what macOS version is
$brew config
macOS: 10.14.2-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
This when you have Command Line tools properly installed and paths set properly.
Earlier i got output as below
macOS: 10.14.2-x86_64
CLT: N/A
Xcode: 10.1
CLT was shown as N/A in spite of having gcc and make working fine and below outputs
$xcode-select -p
/Applications/Xcode.app/Contents/Developer
$pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
$brew doctor
Your system is ready to brew.
Finally doing xcode-select --install resolved my issue of brew unable to find CLT for installing packages as below.
Installing sphinx-doc dependency: python
Warning: Building python from source:
The bottle needs the Apple Command Line Tools to be installed.
You can install them, if desired, with:
xcode-select --install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With