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.

7 Answers 7

30

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.

3
  • 1
    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 @Nanda
    – Purrell
    Mar 13, 2015 at 17:08
  • Just to clarify, you can just do this: xcode-select -switch /Applications/Xcode.app/Contents/Developer/ without having to specify environment variable.
    – Jas
    Oct 30, 2017 at 21:01
  • Great its Working fine for me.! Sep 21, 2019 at 9:55
17

Run this to set your Developer folder:

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
1
  • Thanks, worked for me! Exporting only the path wasn't successful.
    – Karl Adler
    Aug 31, 2016 at 9:59
13

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

1
4

Do the following steps

Open Xcode

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

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.

0
0

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

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

run source ~/.bashrc , and restart terminal.

0

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

Worked in my case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.