问题
Mac OS X 10.8.2
Xcode 4.5.2 (installed at /Applications/Xcode.app)
Triedxcode-select -switch /Applications/Xcode.app
After thatxcode-select -print-path
outputs correct path (/Applications/Xcode.app). Butxcrun -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.
回答1:
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.
回答2:
Run this to set your Developer folder:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
回答3:
Open Xcode > Preferences > Locations > Select your Xcode version from the dropdown and exit Xcode ref
回答4:
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.
回答5:
Do the following steps
Open Xcode
Preferences->Locations->Command Line Tools-> Select Xcode Version
来源:https://stackoverflow.com/questions/14334708/xcrun-cant-find-xcode-path