How to check if XCode command line tools are installed? - xcode

I have a macbook pro with OS X 10.8.2. XCode is installed. I know this as it appears in the Applications directory. There are also the xcodebuild and xcode-select files in /usr/bin. I need to know if the command line tools is installed. Is there a command for it? hat can I do to see if XCode CLT is installed and if yes to find the version installed?

10.15 Catalina Update:
See Yosemite Update.
10.14 Mojave Update:
See Yosemite Update.
10.13 High Sierra Update:
See Yosemite Update.
10.12 Sierra Update:
See Yosemite Update.
10.11 El Capitan Update:
See Yosemite Update.
10.10 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 $?
10.9 Mavericks Update:
Use pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
10.8 Update:
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";
};
}

10.10 Yosemite
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
10.9 Mavericks
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...

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

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

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

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

Go to Applications > Xcode > preferences > downloads
You should see the command line tools there for you to install.

From a programmatic perspective the Homebrew folks have a check for the existence of various files to determine if the command line tools are installed. Currently it always checks for /Library/Developer/CommandLineTools/usr/bin/git and will also check for /usr/include/iconv.h if the OS version is 10.13 or below.

Open your terminal and check to see if you have Xcode installed already with this:
xcode-select -p
in return, if you get this:
/Library/Developer/CommandLineTools
That means you have that Xcode is installed.
Another way you can check would you if you have "HomeBrew" installed you can use the following command to see if you have Xcode and the version:
brew config
And finally, if you don't have the Xcode follow this link to download the Xcode from the Appstore. Xcode from the App Store.
Good Luck.

to use on a bash script:
if ! command -v xcode-select &> /dev/null
then
echo "\t xcode was not found! You need to manually install it :/ "
else
echo "xcode is installed, checking other IOS build tools"
fi

Some contributors write when xcode-select -p or xcode-select -print-path would return /Library/Developer/CommandLineTools that this would mean that CLTs are installed. This is not really correct as xcode-select can be used to switch among multiple Xcode installations and CLTs. Aforementioned commands merely return which development environment is currently in use, i.e. which Xcode or whether CLTs are currently in use. The returned path to some also installed Xcode may then be returned and you cannot deduce from this whether CLTs are actually installed or not.
Moreover, as Apple recommends even to simply delete CLTs by deleting the directory /Library/Developer/CommandLineTools before a reinstallation it may well be that aforementioned commands return /Library/Developer/CommandLineTools despite the fact that they are no longer installed. Even the use of pkgutil is no warranty that CLTs are really installed if directory /Library/Developer/CommandLineTools was previously simply deleted.
The most robust technique is therefore xcode-select --install and the macOS will invite you to install CLTs via an alert, which you can cancel if you wish only to learn about the presence or absence of CLTs. If you prefer a method without any GUI, e.g. in a shell script, then testing for the presence of directory /Library/Developer/CommandLineTools and pkgutil returning "No receipt..." as described above are AFAIK a way to go. E.g. code similar to following
theCLTversion=`pkgutil --pkg-info=com.apple.pkg.CLTools_Executables 2>/dev/null | grep version`
if [ -d /Library/Developer/CommandLineTools ] && [ "$theCLTversion" != "" ]; then
echo "CLTs $theCLTversion installed"
else
echo "CLTs seem not to be installed"
fi
may do the job. However, I have not tested above snippet to lead to correct results on older systems prior to OS X 10.11.6 (El Capitan).

Because Xcode subsumes the CLI tools if installed first, I use the following hybrid which has been validated on 10.12 and 10.14. I expect it works on a lot of other versions:
installed=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables 2>/dev/null || pkgutil --pkg-info=com.apple.pkg.Xcode)
Salt with awk to taste for branching logic.
Of course xcode-select -p handles the variations with a really short command but fails to give the detailed package, version, and installation date metadata.

% xcode-select -h
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
-p, --print-path print the path of the active developer directory
-s , --switch set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path

Run the command xcode-select --install
The answer for this is very simple actually, and for any application for that matter, just try to reinstall it,
It will either install it or it will show you the error, you can stop the process if you don't want.

Related

Errors during make test installing kibana via homebrew on Mac (xcode issue?) [duplicate]

Saw the following error when running an npm install which required node-gyp... but could be triggered by anything which requires xcode-select.
xcode-select: error: tool 'xcodebuild' requires Xcode, but active
developer directory '/Library/Developer/CommandLineTools' is a command
line tools instance
What is the problem?
This problem happens when xcode-select developer directory was pointing to /Library/Developer/CommandLineTools when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode)
Solution:
Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don't have it yet.
Accept the Terms and Conditions.
Ensure Xcode app is in the /Applications directory (NOT /Users/{user}/Applications).
Point xcode-select to the Xcode app Developer directory using the following command:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Note: Make sure your Xcode app path is correct.
Xcode: /Applications/Xcode.app/Contents/Developer
Xcode-beta: /Applications/Xcode-beta.app/Contents/Developer
I was having an issue while trying to install packages using npm.
I got the error: "sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/"
To fix this
I opened Xcode.
Preferences
Locations
Selected the Command Lin Tools: Xcode 6.1.1
Now when installing packages with npm I no longer get errors.
Other solution for those who don't want to install Xcode:
Install Command Line Tools (if you haven't already):
xcode-select --install
Change the active directory:
sudo xcode-select -switch /Library/Developer/CommandLineTools
This worked for me (git).
Xcode > Preferences > Locations > Command Line Tools
Select the option matching your version of Xcode.
Simply run sudo xcode-select -r which should automatically reset the path.
-r, --reset
Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism. This command must be
run with superuser permissions (see sudo(8)), and will affect all users on the system.
I just ran the following command and the issue was resolved for me:
sudo xcode-select --reset
Type this in your terminal
xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
if you installed XCode already, All you have to do is to...
Open XCode
Go To Xcode > Preferences > Locations
From the Command Line Tools Select your XCode
Just in case you're using xcode beta:
sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer
I had to run this first
sudo xcode-select --reset
then
sudo xcode-select -switch /Library/Developer/CommandLineTools
and then it worked.
Download Xcode from App Store.
Go to Xcode preferences/Locations/CommandlineTools
You just have to set it to the Xcode version. It automatically points to '/Application/Xcode.app'
I was having the same problem in high sierra.
running the following command solved it
npm explore npm -g -- npm install node-gyp#latest
Please follow the steps below :
The latest version of Xcode can be downloaded from https://developer.apple.com/xcode/download/
It will be downloaded in the 'Downloads' unless specified otherwise. Please make sure to check the path where you have downloaded and extracted the Xcode
Now unlike other downloaded applications, on extraction, Xcode doesn't give the option to move it to Applications
Note the XCODE-ACTUAL-LOCATION or move it to the Applications
Note if you have downloaded Xcode or Xcode-beta
Based on 4 and 5, execute one of the commands (Do not execute all of them without reading above description):
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
sudo xcode-select -s /[XCODE-ACTUAL-LOCATION]/Xcode.app/Contents/Developer
sudo xcode-select -s /[XCODE-ACTUAL-LOCATION]/Xcode-beta.app/Contents/Developer
Install Xcode from App Store. After installing run xcodebuild with root privileges i.e. sudo xcodebuild and accept the language. After this npm install bcrypt worked like a charm!
Without Xcode: create file /usr/local/bin/xcodebuild with content to cheat XcodeSelect
#!/bin/bash
exit 0
chmod +x /usr/local/bin/xcodebuild
Simple reinstall xcode-select
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
In case you are using Xcode beta, run
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
instead of
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
I was able to solve this error without installing the full Xcode application. You must, however, have xcode command line tools installed.
From here:
$ cd /usr/bin
$ sudo mv xcodebuild xcodebuild.orig (A backup just in case)
$ vim xcodebuild
Paste the following:
#!/bin/bash
if [[ $1 == '-version' ]]; then
echo "Xcode 10.2.1"
echo "Build version 10E1001"
else
/usr/bin/xcodebuild.bak $#
fi
$ sudo chmod +x xcodebuild
XCode2:
sudo xcode-select -s /Applications/Xcode\ 2.app/Contents/Developer
Pay attention to the "\" to escape the space
I had two instance of Xcode installed xcode.app and xcode-beta.app
When I tried to create a build with netbeans it showed me the error
"supported version of xcode and command line tools not found netbeans"
I followed the following steps:
"xcode-select --print-path" is equal to "/Applications/Xcode.app/Contents/Developer"
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform" exists
"xcodebuild -version" starts with "Xcode"
after 1 I found that it is pointing me to xcode-beta.app
so here is the solution which worked like a charm:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
For context, today is Jan 28, 2019.
On my Mac, I did two things to resolve this problem:
Run the following command in your terminal:
sudo xcode-select --install
Restart your Mac.
Until I restarted the computer, the problem kept occurring in my Android Studio. After reboot, it was working just fine. Also note that I did not execute any --switch commands as others are doing. I hope this helps.
Manually installing Command LineTool worked for me.
I stalled xcode through App Store
Still could not download Homebrew
I installed Command Line Tool manually through link.
Bing Bang Boom
https://developer.apple.com/download/more/?=command%20line%20tools
sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
languoguangs-iMac:/ languoguang$ sudo xcode-select -s /Applications/Xcode 10.app/Contents/Developer
xcode-select: error: invalid argument '10.app/Contents/Developer'
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path
languoguangs-iMac:/ languoguang$ sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
because my Xcode name in Application is "Xcode 10",
sudo xcode-select -s "/Applications/Xcode 10.app/Contents/Developer"
works.
In my case,
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
didn't work because my Xcode had some special name. eg) Xcode_11.2.0_beta_2_stackoverflow.app
cd /applications
ls
Then I found my Xcode name, then replace it with
sudo xcode-select -s /Applications/{myXcodeName}.app/Contents/Developer
It worked for me.
None of the above worked for me. I originally installed Command Line Tools separately, and then all of Xcode. What worked for me was to uninstall Command Line Tools as shown here. Then, when trying to run xcode-select again, I was asked to reinstall them.
*By the way, the very reason why I found this thread was because I had installed some libraries (particularly gcc) with macports, presumably using the old Command Line Tools, and then I installed the full Xcode midway into development. So anyways, for my case, I had to reinstall macports after removing the stand-alone Command Line Tools, reinstalling them, reinstalling gcc, and then my compilation worked.
There are only two steps required, and the full XCode.app is not required at all:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
At this point the "Installing Softwre" dialog pops up:
That's it!
None of the above solutions helped me. I was working on an old project, and I had the latest version of NodeJs installed globally (v14.x) on my computer.
No node version above 10.1.x worked for me and when testing I received the same error as above.
Solution
I installed "n" which is a nodeJs version manager like nvm
I downgraded my nodeJs version to 9.x
npm install now works.
I will now need to update my versions, or Specify my node version in my package.json.
The simple fix that worked for me is drag and drop Xcode.app from the current location (In my case it was in downloads) to Applications.

How to update Xcode from command line

I am trying to update Xcode from the command line. Initially I tried running:
xcode-select --install
which resulted in this message:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
So the question remains, is there a way to update Xcode from the command line?
What you are actually using is the command to install the Xcode command line tools - xcode-select --install. Hence the error message you got - the tools are already installed.
The command you need to update Xcode is softwareupdate command [args ...]. You can use softwareupdate --list to see what's available and then softwareupdate --install -a to install all updates or softwareupdate --install <product name> to install just the Xcode update (if available). You can get the name from the list command.
As it was mentioned in the comments here is the man page for the softwareupdate tool.
2019 Update
A lot of users are experiencing problems where softwareupdate --install -a will in fact not update to the newest version of Xcode. The cause for this is more than likely a pending macOS update (as #brianlmerritt pointed out below). In most cases updating macOS first will solve the problem and allow Xcode to be updated as well.
Updating the Xcode Command Line Tools
A large portion of users are landing on this answer in an attempt to update the Xcode Command Line Tools. The easiest way to achieve this is by removing the old version of the tools, and installing the new one.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
A popup will appear and guide you through the rest of the process.
I had the same issue and I solved by doing the following:
removing the old tools ($ sudo rm -rf /Library/Developer/CommandLineTools)
install xcode command line tools again ($ xcode-select --install).
After these steps you will see a pop to install the new version of the tools.
I encountered the same issue when I uninstalled the complete version of Xcode to reinstall the CLI version. My fix was:
sudo xcode-select -s /Library/Developer/CommandLineTools
After installing Command Line Tools (with xcode-select --install), type:
sudo xcode-select --switch /Library/Developer/CommandLineTools/
You should be able to run git now:
10:29 $ git --version
git version 2.17.2 (Apple Git-113)
I got this error after deleting Xcode. I fixed it by resetting the command line tools path with sudo xcode-select -r.
Before:
navin#Radiant ~$ /usr/bin/clang
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.
navin#Radiant ~$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
After:
navin#Radiant ~$ /usr/bin/clang
clang: error: no input files
Just type the commands
cd /Library/Developer/CommandLineTools/Packages/;
open macOS_SDK_headers_for_macOS_10.14.pkg
Reference: https://forums.developer.apple.com/thread/104296
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
I was facing the same problem, resolved it by using the following command.
sudo xcode-select -s /Library/Developer/CommandLineTools
After running the above command then xcode-select -p command showed the following.
/Library/Developer/CommandLineTools
#Vel Genov's answer is correct, except when the version of Xcode can't be updated because it is the latest version for your current version of Mac OS. If you know there is a newer Xcode (for example, it won't load an app onto a device with a recent version of iOS) then it's necessary to first upgrade Mac OS.
Further note for those like me with old Mac Pro 5.1. Upgrading to Mojave required installing the metal gpu (Sapphire AMD Radeon RX 560 in my case) but make sure only HDMI monitor is installed (not 4K! 1080 only). Only then did install Mojave say firmware update required and shut computer down. Long 2 minute power button hold and it all upgraded fine after that!
Catalina update - softwareupdate --install -a won't upgrade xcode from command line if there is a pending update (say you selected update xcode overnight)
I am not sure why this was so tricky for me.
sudo xcode-select --install
Did nothing for me.
softwareupdate --all --install --force
Did nothing for me.
I had to do things in the following order
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
This installed a newer xcode, but not latest.
Then I did
softwareupdate --all --install --force
and they updated completely.
Xcode::Install is a simple cli software that allow you to install/select a specific Xcode version.
You can install it using gem install xcode-install
Then you will be able to install a specific version with xcversion install 9.4.1
And if you have more than one version installed, you can switch version with xcversion select 9.4
You can find more information at https://github.com/KrauseFx/xcode-install
I am now running OS Big Sur. xcode-select --install, and sudo xcode-select --reset did not resolve my issue, neither did the recommended subsequent softwareupdate --install -a command. For good measure, I tried the recommended download from Apple Downloads, but the Command Line Tools downloads available there are not compatible with my OS.
I upvoted the fix that resolved for me, sudo xcode-select --switch /Library/Developer/CommandLineTools/ and added this post for environment context.
I was able to update via CLI using:
softwareupdate --list --verbose
and then
softwareupdate -i Command\ Line\ Tools\ for\ Xcode-13.2
I was trying to use the React-Native Expo app with create-react-native-app but for some reason it would launch my simulator and just hang without loading the app. The above answer by ipinak above reset the Xcode CLI tools because attempting to update to most recent Xcode CLI was not working. the two commands are:
rm -rf /Library/Developer/CommandLineTools
xcode-select --install
This process take time because of the download.
I am leaving this here for any other would be searches for this specific React-Native Expo fix.
I was faced with this today after an update from Xcode (App Store on Mac) updated my Xcode.
My SourceTree wouldn't allow me to do a merge conflict.
In Xcode I found that Command Tools was NOT selected.
I selected it, however still no dice as I was getting the same message of:
I performed the command:
softwareupdate --list
which gave me a list of products, including THREE (3) versions of CommandLine Tools
Software Update Tool
Finding available software
Software Update found the following new or updated software:
Label: Command Line Tools for Xcode-13.2
Title: Command Line Tools for Xcode, Version: 13.2, Size: 577329K, Recommended: YES,
Label: SFSymbolsAuto-3.3
Title: SF Symbols, Version: 3.3, Size: 169368K, Recommended: YES,
Label: Command Line Tools for Xcode-13.3
Title: Command Line Tools for Xcode, Version: 13.3, Size: 718145K, Recommended: YES,
Label: Command Line Tools for Xcode-13.4
Title: Command Line Tools for Xcode, Version: 13.4, Size: 705462K, Recommended: YES,
my version of Xcode is 13.4, so I preceded to try to update just the one.
I used the Label, with escaped spaces (which also works with just quoted label btw "Command Line Tools for Xcode-13.4"
softwareupdate -i Command\ Line\ Tools\ for\ Xcode-13.4
In doing so, ALL 3 updates of Command Line Tools disappeared and I was able to continue.
Hope this helps someone else out there.
Hello I solved it like this:
Install Application> Xcode.app> Contents> Resources> Packages> XcodeSystemResources.pkg.
I arrived here trying to install Appium. Adding my answer in case other folks land here for the same issue.
appium-doctor --ios
... bunch of stuff...
WARN AppiumDoctor ✖ Error running xcrun simctl
... bunch of stuff...
info AppiumDoctor ### Manual Fixes Needed ###
info AppiumDoctor The configuration cannot be automatically fixed, please do the
following first:
WARN AppiumDoctor ➜ Manually install Xcode, and make sure 'xcode-select -p' command shows proper path like '/Applications/Xcode.app/Contents/Developer'
In my case
xcode-select -p
/Library/Developer/CommandLineTools
which appeared wrong...but I knew I had recently updated Xcode and the command line tools
so...
sudo xcode-select -r (sudo required)
then...
xcode-select -p
/Applications/Xcode.app/Contents/Developer
After this, no warning. Appium-doctor returned clean.
xCode version 11.2.1 is necessary for building app in iPad 13.2.3, When I directly try to upgrade from xcode 11.1 to 11.2.1 through App Store it get struck, So after some research , I found a solution to upgrade by removing the existing xcode from the system
So here I am adding the steps to upgrade after uninstalling existing xcode.
Go to Applications and identify Xcode and drag it to trash.
Empty trash to permenently delete Xcode.
Now go to ~/Library/Developer/ folder and remove the contents completely Use sudo rm -rf ~/Library/Developer/ to avoid any
permission issue while deleting
Lastly remove any cache directory associated with xcode in the path ~/Library/Caches/com.apple.dt.Xcode sudo rm -rf
~/Library/Caches/com.apple.dt.Xcode/*
After completing the above steps you can easly install xcode from App Store, which will install the current latest version of xcode
Note: Please take a backup of your existing projects before making the above changes
Update with this one-liner.
softwareupdate --install -a
This reminds me why I hate MacOS. Every time I tried one of these errors I would get the incomprehensible error: No install could be requested (perhaps no UI is present)
Turns out this "CLI" actually needs a graphical session to run. WTF! Very useful when you're actually only ever connecting to the remote mac server over SSH to queue iOS builds.
So the answer for me was:
Physically travel to the Mac, attach screen, mouse and keyboard, and run the command there.
To those having this issue after update to Catalina, just execute this command on your terminal
sudo rm -rf /Library/Developer/CommandLineTools; xcode-select --install;

"xcrun: error: active developer path… does not exist, use xcode-select --switch" when trying to run git. How to fix?

I have been trying to instal the Git on my mac, But every time I use the command $git --version.
I get the following error
xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select)
I have already installed the Xcode on my mac for iOS App development.
I am not sure what this error is trying to say.
My case:
I removed XCode. JetBrains integration with git - breaks. Found this error in terminal.
My soltuion:
I don't want to download XCode to restore PyCharm. So I ran:
sudo xcode-select --reset
So from discussion in the comments above, it seems the right fix here is just to run the command /usr/bin/xcode-select -switch once (i.e., run it with the full path to the executable, rather than just as xcode-select) with /Applications/Xcode.app/Contents/Developer/ as the argument:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
After running that once, everything should work as expected from then on.
sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
and reboot your computer.
Try this below answer. It's worked for me.
Open your Xcode Preferences,
--> Select Locations
--> Select your specific Xcode version in Command Line Tools
It was easier for me to let Xcode pick the install location of Command Line Tools for me, instead of the other way around. After downloading the .xip file from the Apple Developer downloads page, expanding the compressed contents, and installing Xcode.App, I was able to open it using Spotlight.
And open preferences:
And select my Command Line Tools under "Locations".
You can install git via the brew package manager for Mac. I recommend installing software this way since it's a great way to manage your installed packages in one place. For example, you can do brew update to get a list of the latest package updates, or brew upgrade to upgrade all of your software installed through brew.
To install brew, open a terminal window and run:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Update your brew packages with brew update
Install git with brew install git
I had installed git, then returned to a terminal window open prior to the installation. I try running command git --version and this raised error message below. To resolve, I ran command source /etc/profile in same terminal window. BTW, terminal window is inside my Webstorm and my end goal is to git init and setup git for my new reactjs project. Happy coding!
The error:
xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use \`xcode-select --switch path/to/Xcode.app\` to specify the Xcode that you wish to use for command line developer tools (or see \`man xcode-select\`)

Xcode is not currently available from the Software Update server

I have problems with my macport after update to OS X 10.9.
I try to follow this manual https://trac.macports.org/wiki/Migration to fix them.
But when I install Command Line Tools:
xcode-select --install
I get message
Can't install the software because it is not currently available from
the Software Update server.
Meanwhile I successfully updated my other machine to OS X 10.9. and installed command-line tools with no problems, so they must be available.
What is the problem here?
You can download the command line tools for OS X Mavericks manually from here:
https://developer.apple.com/downloads/index.action?name=for%20Xcode
For OSX 10.11 or more you can download from here https://developer.apple.com/download/more/.
(The link in the accepted answer doesn't display command line tools for El Capitan (OSX 10.11))
If you are trying this on a latest Mac OS X Mavericks, command line tools come with the Xcode 5.x
So make sure you have installed & updated Xcode to latest
after which make sure Xcode command line tools is pointed correctly using this command
xcode-select -p
Which might show some path like
/Applications/Xcode.app/Contents/Developer
Change the path to correct path using the switch command:
sudo xcode-select --switch /Library/Developer/CommandLineTools/
this should help you set it to correct path, after which you can use the same above command -p to check if it is set correctly
I faced same problem of Can't install the software because it is currently not available from the Software Update Server. You may try following steps instead to make the Software Update initiate update for the Command Line Tools.
Check if Command Line Tools Update is mentioned in your list of softwares to be updated by using following command: softwareupdate -l
If Command Line Tools Update is not mentioned in that list, then manually make it part of the list using following command which will create a temporary file: sudo touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Verify that the list now has the Command Line Tools mentioned by running softwareupdate -l again.
Now, press Cmd+Space to initiate Mac's Spotlight Search. Search for Software Update. Start the Software Update.
That will show you following kind of dialog for installing the Command Line Tools. Install away the update and be merry. :)
Remove the temporary file created in Step 2: sudo rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress.
I deleted the command tools directory given by xcode-select -p due to npm gyp error.
xcode-select failed to install the files with the not available error.
I ran the Xcode application and the command tools installed as part of the startup.
npm worked.
However this didn't fully fix the tools. I had to use xcode-select to switch the path to the Developer directory within the Xcode application directory.
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
MacOS catalina.
I just got the same error after I upgraded to 10.14 Mojave and had to reinstall command line tools (I don't use the full Xcode IDE and wanted command line tools a la carte).
My xcode-select -p path was right, per Basav's answer, so that wasn't the issue.
I also ran sudo softwareupdate --clear-catalog per Lambda W's answer and that reset to Apple Production, but did not make a difference.
What worked was User 92's answer to visit https://developer.apple.com/download/more/.
From there I was able to download a .dmg file that had a GUI installer wizard for command line tools :)
I installed that, then I restarted terminal and everything was back to normal.
I know this is an old post but I also ran into this problem today. I found out that when I executed sudo softwareupdate -l the Command Line Tools were listed as an update, so I installed them using sudo softwareupdate -i -a.
This error can occur if you are using a software update server which doesn't host the required package.
You can check this by running
defaults read /Library/Preferences/com.apple.SoftwareUpdate
and seeing if you have an entry called CatalogURL or AppleCatalogURL
You can point back at the Apple software update server by either removing this entry or using the command
sudo softwareupdate --clear-catalog
And then run the command line tools install again.
I got the same issue on MacOS Catalina.
I think I identified the root cause: I have switched the default Apple ID account and the new one was not activated as a Developer account. When I ran the xcode-select --install command, I got the same error as stated in the issue description.
After reading this post on stackoverflow, I went on https://developer.apple.com/downloads and I was asked to accept Developers terms. I think it enabled my account as a developer one. Then, I tried to run xcode-select --install again and it worked.
The command
xcode-select --install
proposes 3 options: Get Xcode; Not Now; Install.
When I choose to get full Xcode the command finished successfully. It took a while, but this way I was able to complete all macports migration instructions.
Once you get the command line tools loaded as described by Nikos M in his excellent answer above you will need to agree to the gcc license and if you are using ruby gems you may need to link llvm-gcc as gcc-4.2.
If you do not do these the gem install will report "You have to install development tools first." after you have already installed them.
The steps are:
sudo gcc
sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2
The gcc must be run once under sudo so Apple can update their license info, you don't need an input file, it will update the license before it checks its arguments. The link is needed so that ruby 1.9 can find the compiler when building certain gems, such as the debugger. This may be fixed in ruby 2.x, but I'll cross that bridge when I get there.
I had to run Xcode.app and agree to the License Agreement
Setup: Brand new MacBook with Mavericks, then brew install and other c/l type things 'just work'.
I solved this by going to the App Store and installing Xcode.
It was a pretty large 11GB install, so this is probably overkill. But, as a last resort, it seems to have solve my issues. In the middle of the installation (well around 10GB), Mac OS told me there was an update to Command Line Tools for Xcode. Performing this installation won't fix anything until Xcode is fully installed.
Once the install is done, it should start working (after you accept the license agreement).
Command + Space
Search for Xcode
Open it and accept license
Then run again from terminal xcode-select --install
Had the same issue and was getting the same error. When i ran xcode-select -p, it gave output as /Library/Developer/CommandLineTools. So that means xcode was already installed in my system. Then i ran steps as given on this answer. After which any command which required xcode ran successfully.

Command Line Tools on OSX 10.9: Installed, but can't show up?

I am trying to install CLT on OSX 10.9 Mavericks.
Before I ask, I referred to these questons:
Failed to install command line tools on OSX Mavericks
Xcode 4.4 and later install Command Line Tools
I installed XCode 5 via the App Store, with the latest version.
Then, as mentioned in all kinds of tutorials, I typed "xcode-select --install" in the bash, however, there weren't any window telling me to install the CLI, but these outputs:
$ xcode-select --install
Usage: xcode-select -print-path
or: xcode-select -switch <xcode_folder_path>
or: xcode-select -version
Arguments:
-print-path Prints the path of the current Xcode folder
-switch <xcode_folder_path> Sets the path for the current Xcode folder
-version Prints xcode-select version information
I tried to run "/System/Library/CoreServices/Install\ Command\ Line\ Developer\ Tools.app" manually, but nothing showed up.
I opened the package, and tried
"sudo /System/Library/CoreServices/Install\ Command\ Line\ Developer\ Tools.app/Contents/MacOS/Install\ Command\ Line\ Developer\ Tools "
And failed like this:
"2013-11-01 19:48:45.060 Install Command Line Developer Tools[42474:507] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x6207, name = 'com.apple.dt.CommandLineTools.installondemand'
See /usr/include/servers/bootstrap_defs.h for the error codes."
I enabled root account and try to run it under root, same output.
Unknown of what that means, I tried "--pkg-info=com.apple.pkg.DeveloperToolsCLI"
It seems that CLI is not working, the outputs are:
"No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'."
I went to Apple 's site, downloaded and installed this file:
command_line_tools_os_x_mavericks_for_xcode__late_october_2013.dmg
Everything goes smoothly, no error reported during the installation.
However, when I try to find the CLI in XCode, it is not there.
Another time "--pkg-info=com.apple.pkg.DeveloperToolsCLI", still "No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.".
Now I am completely puzzled...how can I install this CLI?
Thank you very much in advance.
Make sure that you have updated to the most recent version of Mavericks, then reboot. Run xcode-select --install again. Otherwise, uninstall XCode and reinstall again from App Store.
I called sudo rm -rf /Library/Developer/CommandLineTools and then xcode-select --install.
sw_vers:
ProductName: Mac OS X
ProductVersion: 10.15.2
BuildVersion: 19C57

Resources