xcrun can't find Xcode path
Asked Answered
L

7

9

Mac OS X 10.8.2
Xcode 4.5.2 (installed at /Applications/Xcode.app)

Tried
xcode-select -switch /Applications/Xcode.app
After that
xcode-select -print-path
outputs correct path (/Applications/Xcode.app). But
xcrun -find gcc
fails with error
xcrun: Error: could not stat active Xcode path '/Developer/Xcode.app/Contents/Developer'. (No such file or directory).

Update 1:
Here are permission specifiers

ls -l /Applications/Xcode.app  

total 0
drwxr-xr-x@ 16 my admin 544 Oct 30 23:38 Contents

ls -l /Applications/Xcode.app/Contents  

total 24
drwxr-xr-x@ 8 my admin 272 Oct 30 23:30 Applications
drwxr-xr-x@ 9 my admin 306 Oct 30 23:36 Developer
drwxr-xr-x@ 5 my admin 170 Oct 30 23:30 Frameworks
-rw-r--r--@ 1 my admin 15289 Oct 19 14:22 Info.plist
drwxr-xr-x@ 3 my admin 102 Aug 5 08:03 Library
drwxr-xr-x@ 3 my admin 102 Oct 30 23:10 MacOS
drwxr-xr-x@ 16 my admin 544 Oct 30 23:37 OtherFrameworks
-rw-r--r--@ 1 my admin 8 Oct 19 14:22 PkgInfo
drwxr-xr-x@ 56 my admin 1904 Oct 30 23:36 PlugIns
drwxr-xr-x@ 52 my admin 1768 Oct 30 23:46 Resources
drwxr-xr-x@ 17 my admin 578 Oct 30 23:46 SharedFrameworks
drwxr-xr-x@ 4 my admin 136 Oct 17 21:50 XPCServices
drwxr-xr-x@ 3 my admin 102 Oct 30 23:10 _CodeSignature
-rw-r--r--@ 1 my admin 523 Oct 30 23:10 version.plist

ls -l /Applications/Xcode.app/Contents/Developer  

total 0
drwxr-xr-x@ 3 my admin 102 Aug 5 07:29 Documentation
drwxr-xr-x@ 7 my admin 238 Dec 20 21:09 Library
drwxr-xr-x@ 7 my admin 238 Oct 30 23:46 Makefiles
drwxr-xr-x@ 5 my admin 170 Oct 30 23:28 Platforms
drwxr-xr-x@ 3 my admin 102 Oct 10 01:37 Toolchains
drwxr-xr-x@ 22 my admin 748 Oct 30 23:31 Tools
drwxr-xr-x@ 7 my admin 238 Oct 30 23:46 usr
Please help.

Lonne answered 15/1, 2013 at 9:34 Comment(0)
L
31

Fixed! In terminal:

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

Explanation:
While reading man xcrun I noticed that there is DEVELOPER_DIR environment variable that takes precedence of xcode-select. So here we are setting that variable to correct path.

Lonne answered 15/1, 2013 at 13:30 Comment(3)
This answer is probably not idea since xcode-select should be able to configure the path automatically without the need for maintaining an extra environment variable. See answer from @DuologueSlipcover
Just to clarify, you can just do this: xcode-select -switch /Applications/Xcode.app/Contents/Developer/ without having to specify environment variable.Goddamned
Great its Working fine for me.!Malachi
D
17

Run this to set your Developer folder:

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
Duologue answered 31/1, 2014 at 7:58 Comment(1)
Thanks, worked for me! Exporting only the path wasn't successful.Seymour
J
14

Open Xcode > Preferences > Locations > Select your Xcode version from the dropdown and exit Xcode ref

Jemena answered 24/12, 2018 at 10:13 Comment(1)
That was really easy! Thanks!Elisavetpol
G
5

Do the following steps

Open Xcode

Preferences->Locations->Command Line Tools-> Select Xcode Version

Godfearing answered 12/6, 2019 at 11:45 Comment(0)
T
2

I have tried all the possible options:

  • Re-installing Xcode
  • Changed all sort of paths
  • re-installed developer tools
  • I even re-installed the operating system!

Downloading the latest GIT version from Here did the trick though.

I believe it's an error from upgrading the operating system. I think a clean/format reinstall would have fixed it as well (since all the settings are being kept)

Please note: Restart the current Terminal window & This is not a temporary solution.

Tourneur answered 25/11, 2015 at 14:36 Comment(0)
A
0

Add the following line to '~/.bashrc' file:

export DEVELOPER_DIR=”/Applications/XCode.app/Contents/Developer”

run source ~/.bashrc , and restart terminal.

Alverson answered 14/12, 2020 at 10:6 Comment(0)
R
0

sudo xcode-select --switch path/to/Xcode.app

Worked in my case.

Rea answered 2/5, 2022 at 11:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.