xcrun: Error: could not stat active Xcode path '/Volumes/Xcode/Xcode45-DP1.app/Contents/Developer'. (No such file or directory)
Asked Answered
A

7

77

I've been beating my head against the desk all day trying to fix this!!!

I have tried the suggested xcode-select -switch /path/to/xcode/ as suggested here but it still gives me this error!

I have now completely removed XCode 4.4 and the command line tools as well, and running the xcrun still gives me this error!

Even installing a new copy of Xcode and the command line tools produces this error!!

Result of commands..

sh-3.2# xcode-select -print-path
/Applications/Xcode.app/Contents/Developer
sh-3.2# xcrun -find
xcrun: Error: could not stat active Xcode path '/Volumes/Xcode/Xcode45-DP1.app/Contents/Developer'.           (No such file or directory)
Autoharp answered 14/8, 2012 at 21:29 Comment(0)
A
-11

The solution that finally worked was by reinstalling 10.8, reinstalling Xcode, and then reinstalling the command line tools.

Autoharp answered 27/8, 2012 at 15:11 Comment(6)
Aaron's answer a better solution.Ovida
Issue was fixed by Aaron's fix.Concupiscent
No, it was not. Only after reinstalling Mountain Lion did it work.Autoharp
I can't understand, why people minus this answer. Probably it's not the best solution, but solution anyway. P.S. I tried both answers above and it didn't work for me.Jemison
I feel that Aarons should be the correct answer. I did it and in 1 shot, evyerhting works.Stivers
Aarons answer is the correct answer with sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/ insteadMonohydroxy
P
209

Solution #1 (affects all users)

xcode-select is the answer. You are either pointing at the wrong path or you are not doing it as a root user. Try this in Terminal:

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

and then type your password.

Solution #2 (affects only you)

If

  • you don't want to sudo, or
  • you don't have superuser permissions, or
  • solution #1 doesn't work

override the DEVELOPER_DIR environment variable instead:

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"

Optional: you can make this persist between login sessions by editing your .bash_profile file.

If neither solution works, post your error message.

Porridge answered 15/8, 2012 at 18:40 Comment(14)
Also note that you no longer have to point to the Developer folder inside the app, you can just point to the app now.Porridge
@Autoharp (1) Did you try running the xcode-select under sudo? (2) xcrun requires a specific utility parameter. For whatever command you're trying to do, try adding the --kill-cache parameter, like xc-run --kill-cache xcode-select for example.Porridge
@Aaron I tried xcrun --kill-cache xcode-select, but it says again: could not stat active Xcode pathJemison
@Aaron Do you know where to find config file for that?Jemison
@Flink I think it's in a database, not an easy-to-edit text file, which is why they have this app. What is the output of xcode-select --print-path?Porridge
@Flink Also, I'm wondering if you are running an older version of the command line tools. What if you sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer?Porridge
@Flink To update your command line tools, go to Xcode -> Preferences -> Downloads -> Command Line Tools -> Update.Porridge
@Aaron xcode-select --print-path gives right path: /Applications/Xcode.app. No, I use the latest command tools...Jemison
@Flink the --print-path command should return /Applications/Xcode.app/Contents/Developer. Did you try sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer? If not, sure, give reinstallation a whirl, it shouldn't take too long.Porridge
I changed that, but problem still exists. I'll try to reinstall. Thanks anyway for helping me ;)Jemison
FWIW, this fixed my borked gitlab vagrant install: github.com/gitlabhq/gitlab-vagrant-vmStanding
i've tried sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/ and that solved the problemMonohydroxy
You just helped me with the same problem after installing Xcode 5 preview. No luck with xcode-select -switch, but exporting the DEVELOPER_DIR did the trick.Locoweed
I encountered this error after I renamed my Xcode app to Xcode5 in order to distinguish it from Xcode4.6.3 in the dock. Then the recommended solution worked great, with the path set to match - i.e., /Applications/Xcode5.app/Contents/DeveloperBrindisi
J
15

The problem is that /usr/share/xcode-select/xcode_dir_link points to an old folder, and doesn't updates when command

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/ is executed.

Solution: delete this link and create it manually.

Jemison answered 22/11, 2012 at 8:57 Comment(3)
I don't see /usr/share/xcode-select/xcode_dir_link (or even /usr/share/xcode-select/) when using the current version of Xcode.Porridge
Thanks! sudo xcode-select -switch /Applications/Xcode.app didn't work for me, but this did.Yevetteyew
Thanks, seems to work if I don't have XCode installed, only the command line toolsMinnieminnnie
E
7

This worked for me:

  1. XCode preferences/Locations/Command Line Tools - set to proper version and location
  2. XCode preferences/Downloads - install command line tools
Ebonyeboracum answered 21/9, 2012 at 17:17 Comment(0)
M
2

Solutions above didn't help me. Removing old system links helped me. It is described here: Error: Can't run /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/ibtool (no such file)

Mcadams answered 25/11, 2013 at 19:1 Comment(0)
A
2

I'd the same error on 10.9. I didn't had XCode installed on my system and I manually updated the XCode command line tools. After that following command fixed the error for me:

sudo xcode-select -switch /
Alienate answered 26/10, 2014 at 12:16 Comment(0)
B
1

I've seen this with only mac systems since it considers running few commands such as gcc git as system level commands and part of command line developer tools.

I had faced this after uninstalling xcode. So the solution is to either install xcode which comes pre packed with the tools or just install the tools by running xcode-select --install.

Refs http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/

Brigitte answered 13/11, 2018 at 8:19 Comment(0)
A
-11

The solution that finally worked was by reinstalling 10.8, reinstalling Xcode, and then reinstalling the command line tools.

Autoharp answered 27/8, 2012 at 15:11 Comment(6)
Aaron's answer a better solution.Ovida
Issue was fixed by Aaron's fix.Concupiscent
No, it was not. Only after reinstalling Mountain Lion did it work.Autoharp
I can't understand, why people minus this answer. Probably it's not the best solution, but solution anyway. P.S. I tried both answers above and it didn't work for me.Jemison
I feel that Aarons should be the correct answer. I did it and in 1 shot, evyerhting works.Stivers
Aarons answer is the correct answer with sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/ insteadMonohydroxy

© 2022 - 2024 — McMap. All rights reserved.