Invalid active developer path on MAC OS X after installing Ruby
Solution 1
I started getting the same error after updating to OS X El Capitan.
In my case, all I did was to install it:
sudo xcode-select --install
And it works fine for me.
Solution 2
[Update] The steps below are for OS X 10.10 (Yosemite). Those experiencing this because of an upgrade to 10.11 (El Capitan) seem need to only run sudo xcode-select --install
as described in the accepted answer.
I found a suggestion here which indicated
sudo xcode-select -switch /
as the fix. However, this threw an error that the developer path was invalid.
Instead, for me, I modified this to
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
(which is a mixture of the two referenced link solutions) and this worked.
[Edit]
Try using
xcode-select --print-path
to find your developer path if /Applications/Xcode.app/Contents/Developer/ is still invalid for you.
Solution 3
I know this is quite old but I got the same issue and then I fixed it by doing couple more extra steps. Problem came when Terminal could not find the actual path of the Command Line Tools.
- If you had Xcode and then removed it, then Terminal is referring to
the Command Line Tools inside the Xcode folder. Try using this
command and check what your path is,
xcode-select --print-path
. This would most likely print/Applications/Xcode.app/Contents/Developer
. - Now to fix this, reinstall the command line tools for xcode. Initially remove any previous installations using
sudo rm -rf /Library/Developer/CommandLineTools
. - Then install the command line tools
sudo xcode-select --install
Now the final step, change the path for the CLT to the actual path usingsudo xcode-select -switch /Library/Developer/CommandLineTools/
this will fix it.
Solution 4
I resolved the issue with the below steps.
Xcode -> Preferences -> Locations -> Command Line Tools -> Select the command tool matching your Xcode version.
Solution 5
I started getting the same error after i update macOS Mojave to macOS Catalina.
I just installed few command lines in Terminal,
1. $ sudo gem install cocoapods
2. $ sudo xcode-select --install
3. $ chsh -s /bin/zsh
Then,
Xcode -> Preferences -> Locations -> Command Line Tools and confirm you have current Xcode version selected there.
And it works fine with me. Thanks!!
Admin
Updated on January 07, 2020Comments
-
Admin over 4 years
I get this error:
xcrun: error: invalid active developer path (/Applications/Xcode.app), missing xcrun at: /Applications/Xcode.app/usr/bin/xcrun
This solution works, but the error occurs again after closing my terminal and reopening it; I then have to run the same commands every time I open a new terminal window.
How can I apply these changes such that they will save after closing the terminal window out?
-
Charles Lillo over 8 yearsThank you for this! Ran into this issue after updating to the Xcode 7.0 beta
-
Mikey over 8 yearsinvalid directory here
-
TMKasun over 8 yearsI'm also getting
xcode-select: error: invalid developer directory '/Applications/Xcode.app/Contents/Developer/'
Error,(I'm on MAC El Capitan) -
Admin over 8 years@mikedroid Try using 'xcode-select --print-path' to find your path, and then replace the bit after '-switch' with that
-
Admin over 8 years@TMKasun Try using the advice I gave to mikedroid above (xcode-select --print-path)
-
sevenseacat over 8 years@DavidLambl didn't help. Still invalid directory.
-
TMKasun over 8 years@DavidLambl Thanks , I tried it but didn't work instead
xcode-select --install
worked for me. -
Admin over 8 years@sevenseacat maybe try
xcode-select --install
as TMKasun and Joe pointed out? -
ItsGeorge over 8 yearsThis worked for me after an El Capitan upgrade. Thanks.
-
Dani over 8 years
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
-
Dani over 8 yearsI tried using
xcode-select --install
but it prompted :xcode-select: error: command line tools are already installed, use "Software Update" to install updates
-
Srini about 8 yearsSame issue here @DanutPralea, did yours get resolved?
-
Srini about 8 years@DanutPralea - Just use
sudo Xcode-select -switch /
, instead of using the developer path. I'm on Capitan and this worked for me. -
Shuvo over 5 yearsFor command line tools are already installed issue, this should work : 1. removing the old tools ($ rm -rf /Library/Developer/CommandLineTools) 2. 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.
-
Incinerator over 5 yearsThis worked for me after updating to MacOS Mojave. I didn't have to use
sudo
though. -
Greg over 4 yearsThis solution worked for Mojave 10.14.6 with Xcode 10.2.1. Thanks.
-
Nij over 4 yearsThis happens when you change path for Xcode. This solved my issue.
-
ArtOfWarfare over 4 yearsHave to restart IntelliJ after running this command before it stops displaying this error.
-
hmali over 4 yearsyeah... done with all three steps but the 4th one was missing.. 4th one did the trick for me :)
-
Ryan over 4 yearsI love how everyone is posting steps to follow and not a single one of them has diagnosed the problem first. Don't give people a hundred and one commands to screw up their computer state by trying. Diagnose THEN treat.
-
Ryan over 4 yearsI love how everyone is posting steps to follow and not a single one of them has diagnosed the problem first. Don't give people a hundred and one commands to screw up their computer state by trying. Diagnose THEN treat.
-
Anjali Kevadiya over 4 yearsIt’s not a trial!! I face the same problem and i tried all above answers to resolve my issue but something was missing and I didn’t know what! And finally i come up with solution of my problem by my above answer and it worked perfectly for me! No one wants to waste people’s time. People answer what they have faced and how they over come to this issue.
-
Tripti Kumar over 4 yearsWorked well for MacOS Catalina v 10.15.1
-
Bahman.A over 3 yearsCan someone help me please, I can't install Xcode CLT because of this error "Can’t install the software because it is not currently available from the Software Update server.". I've tried all the suggested path reset approaches but didn't work. My main issue is that when I run npm install it complains about Xcode not available. I'm on macOS Catalina the latest version actually updated a minute ago. Thanks!
-
Noname over 3 yearsit helped me <3
-
Chetan Prajapati almost 3 yearsReally @AnjaliKevadiya the all I need to do is last step only. And all done. Thanks.
-
Mohammed Hasan over 2 yearsThis solution worked for me.
-
Hanzala Raza about 2 yearsWorked for me .. Thanks buddy <3