xcrun无法找到Xcode路径

M.Y*_*.Y. 6 xcode command-line xcrun

Mac OS X 10.8.2
Xcode 4.5.2(安装在/Applications/Xcode.app)

尝试
xcode-select -switch /Applications/Xcode.app
之后
xcode-select -print-path
输出正确的路径(/Applications/Xcode.app).但
xcrun -find gcc
失败并出现错误
xcrun:错误:无法统计活动Xcode路径'/Developer/Xcode.app/Contents/Developer'.(没有相应的文件和目录).

更新1:
这是权限说明符

ls -l /Applications/Xcode.app  
Run Code Online (Sandbox Code Playgroud)

总计0
drwxr-xr-x @ 16 my admin 544 Oct 30 23:38内容

ls -l /Applications/Xcode.app/Contents  
Run Code Online (Sandbox Code Playgroud)

总计24
drwxr-xr-x @ 8 my admin 272 Oct 30 23:30申请
drwxr-xr-x @ 9我的管理员306 10月30日23:36开发人员
drwxr-xr-x @ 5我的管理员170 10月30日23:30框架
-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 10月30日23:36 PlugIns
drwxr-xr-x @ 52 my admin 1768 10月30日23:46资源
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  
Run Code Online (Sandbox Code Playgroud)

总计0
drwxr-xr-x @ 3 my admin 102 Aug 5 07:29文档
drwxr-xr-x @ 7 my admin 238 Dec 20 21:09库
drwxr-xr-x @ 7 my admin 238 10月30日23:46 Makefiles
drwxr-xr-x @ 5 my admin 170 10月30日23:28平台
drwxr-xr-x @ 3我的管理员102 10月10日01:37工具链
drwxr-xr-x @ 22我的管理员748 10月30日23:31工具
drwxr- xr-x @ 7我的管理员238 10月30日23:46 usr
请帮忙.

M.Y*_*.Y. 25

固定!在终端:

$ DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer/"  
$ export DEVELOPER_DIR  
Run Code Online (Sandbox Code Playgroud)

说明:
在阅读时man xcrun我发现有一个DEVELOPER_DIR环境变量优先于xcode-select.所以我们在这里设置该变量来纠正路径.


小智 15

运行此命令以设置您的Developer文件夹:

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)


Faw*_*waz 8

打开Xcode>首选项>位置>从下拉列表中选择您的Xcode版本,然后退出Xcode 引用


Mah*_*ari 5

执行以下步骤

打开Xcode

首选项 -> 位置 -> 命令行工具 -> 选择 Xcode 版本