Invalid active developer path on MAC OS X after installing Ruby
[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.
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 tothe Command Line Tools inside the Xcode folder. Try using thiscommand 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.