xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist

XcodePathXcrun

Xcode Problem Overview


I'm having xcode issues when I try to use brew and git:

>xcrun: error: active developer path ("/Applications/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 can type xcode-select and it shows that the command exists. When I type xcode-select -p it shows:

>/Applications/Xcode.app/Contents/Developer

but when I do which xcode-select, it gives me:

>/usr/bin/xcode-select

I've tried to use the command switch and install again via Apple Developer site but none of these options have work so far... How can I fix this?

Xcode Solutions


Solution 1 - Xcode

I tried that and it didn't work but I found the answer. I just had to reset the developer's path:

$ sudo xcode-select --reset

Now everything is normal

Solution 2 - Xcode

Mostly this error occurs when you have installed a newer version of xcode. And the command line tools are yet to be initialized.

To resolve this: Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Please select the Xcode version for tools.

Example (For Xcode 10.0 (10A255) ): Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Select Xcode 10.0 (10A255).

For more details please see the attached image. Hope it helps.

-- Thanks


Select Command Line Tools

Solution 3 - Xcode

In my case, I had uninstalled Xcode and then issues with git cli started. I solved the problem running the following commands:

$ sudo xcode-select -r
$ sudo xcode-select --switch /Library/Developer/CommandLineTools

and then validating new path with:

$ sudo xcode-select -p

Hope this helps!

Solution 4 - Xcode

I have faced the same issue as I have uninstalled the XCode abruptly, running the below command (from Terminal) helped me to resolve this.

sudo xcode-select -switch /

Solution 5 - Xcode

This error coming because xcode get deleted, corrupt or moved. In my case i removed xcode from my Mac and faced the same issue.

I fixed it by simple two steps

  1. Open Terminal
  2. Simply run following command
sudo xcode-select -r

And now error has resolved. Hope it will helpful.

Solution 6 - Xcode

Use this:

sudo xcode-select -switch /

This should solve the problem.

Solution 7 - Xcode

How about what the error suggests? Did you try that?

xcode-select --switch /Applications/Xcode.app

That should do the trick.

Solution 8 - Xcode

For me it helps to install Xcode CLI xcode-select --install after uninstalling XCode (I don't develop for the OSx or iOS)

Then I could successfully build downloaded source with make

Solution 9 - Xcode

Try error suggestion :

sudo xcode-select --switch /Applications/Xcode.app

And Then test Git Executable Path.

enter image description here

Solution 10 - Xcode

In my case such error occurred after I has tried to symbolicate crash report, and according to a manual, entered command export DEVELOPER_DIR=”/Applications/Xcode.app/Contents/Developer”

I tried some proposed here solutions but nothing helped.

Then I realized that I have added an environment variable DEVELOPER_DIR to my terminal and this led to error: "xcrun: error: missing DEVELOPER_DIR path:"

Then I've just reboot my terminal, that cleaned the environment variable and the error disappeared.

(FYI: environment variables may be checked with printenv command in terminal)

Solution 11 - Xcode

I had the same problem and had to remove completely Developer tools, and reinstall:

$ rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install

Tip: because Xcode had been improperly uninstalled, I had to manually (re)move the Xcode app, too:

$ mv /Applications/Xcode.app/ /Applications/Xcode.app.bak

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondevB78View Question on Stackoverflow
Solution 1 - XcodedevB78View Answer on Stackoverflow
Solution 2 - XcodeHarjot SinghView Answer on Stackoverflow
Solution 3 - XcodeJosé Gil RamírezView Answer on Stackoverflow
Solution 4 - XcodeBharath KumarView Answer on Stackoverflow
Solution 5 - XcodeAmit Kumar PROView Answer on Stackoverflow
Solution 6 - XcodebruceparkerView Answer on Stackoverflow
Solution 7 - XcodeTobi NaryView Answer on Stackoverflow
Solution 8 - XcodeNikolay IgnatyevView Answer on Stackoverflow
Solution 9 - XcodeMir MahfuzView Answer on Stackoverflow
Solution 10 - XcodeViktoRView Answer on Stackoverflow
Solution 11 - XcodeJohann8View Answer on Stackoverflow