Invalid active developer path on MAC OS X after installing Ruby

44,934

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.

  1. 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.
  2. Now to fix this, reinstall the command line tools for xcode. Initially remove any previous installations using sudo rm -rf /Library/Developer/CommandLineTools.
  3. Then install the command line tools sudo xcode-select --install Now the final step, change the path for the CLT to the actual path using sudo 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!!

Share:
44,934
Admin
Author by

Admin

Updated on January 07, 2020

Comments

  • Admin
    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
    Charles Lillo over 8 years
    Thank you for this! Ran into this issue after updating to the Xcode 7.0 beta
  • Mikey
    Mikey over 8 years
    invalid directory here
  • TMKasun
    TMKasun over 8 years
    I'm also getting xcode-select: error: invalid developer directory '/Applications/Xcode.app/Contents/Developer/' Error,(I'm on MAC El Capitan)
  • Admin
    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
    Admin over 8 years
    @TMKasun Try using the advice I gave to mikedroid above (xcode-select --print-path)
  • sevenseacat
    sevenseacat over 8 years
    @DavidLambl didn't help. Still invalid directory.
  • TMKasun
    TMKasun over 8 years
    @DavidLambl Thanks , I tried it but didn't work instead xcode-select --install worked for me.
  • Admin
    Admin over 8 years
    @sevenseacat maybe try xcode-select --install as TMKasun and Joe pointed out?
  • ItsGeorge
    ItsGeorge over 8 years
    This worked for me after an El Capitan upgrade. Thanks.
  • Dani
    Dani over 8 years
    xcode-select: error: command line tools are already installed, use "Software Update" to install updates
  • Dani
    Dani over 8 years
    I tried using xcode-select --install but it prompted : xcode-select: error: command line tools are already installed, use "Software Update" to install updates
  • Srini
    Srini about 8 years
    Same issue here @DanutPralea, did yours get resolved?
  • Srini
    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
    Shuvo over 5 years
    For 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
    Incinerator over 5 years
    This worked for me after updating to MacOS Mojave. I didn't have to use sudo though.
  • Greg
    Greg over 4 years
    This solution worked for Mojave 10.14.6 with Xcode 10.2.1. Thanks.
  • Nij
    Nij over 4 years
    This happens when you change path for Xcode. This solved my issue.
  • ArtOfWarfare
    ArtOfWarfare over 4 years
    Have to restart IntelliJ after running this command before it stops displaying this error.
  • hmali
    hmali over 4 years
    yeah... done with all three steps but the 4th one was missing.. 4th one did the trick for me :)
  • Ryan
    Ryan over 4 years
    I 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
    Ryan over 4 years
    I 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
    Anjali Kevadiya over 4 years
    It’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
    Tripti Kumar over 4 years
    Worked well for MacOS Catalina v 10.15.1
  • Bahman.A
    Bahman.A over 3 years
    Can 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
    Noname over 3 years
    it helped me <3
  • Chetan Prajapati
    Chetan Prajapati almost 3 years
    Really @AnjaliKevadiya the all I need to do is last step only. And all done. Thanks.
  • Mohammed Hasan
    Mohammed Hasan over 2 years
    This solution worked for me.
  • Hanzala Raza
    Hanzala Raza about 2 years
    Worked for me .. Thanks buddy <3