xcrun 找不到 Xcode 路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14334708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
xcrun can't find Xcode path
提问by M.Y.
Mac OS X 10.8.2
Xcode 4.5.2 (installed at /Applications/Xcode.app)
Mac OS X 10.8.2
Xcode 4.5.2(安装在 /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).
xcode-select -switch /Applications/Xcode.app
之后尝试xcode-select -print-path
输出正确的路径(/Applications/Xcode.app)。但xcrun -find gcc
失败并出现错误
xcrun: Error: could not stat active Xcode path '/Developer/Xcode.app/Contents/Developer'。(无此文件或目录)。
Update 1:
Here are permission specifiers
更新 1:
这里是权限说明符
ls -l /Applications/Xcode.app
total 0
drwxr-xr-x@ 16 my admin 544 Oct 30 23:38 Contents
总计 0
drwxr-xr-x@ 16 我的管理员 544 Oct 30 23:38 内容
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
总计 24
drwxr-xr-x@ 8 我的管理员 272 Oct 30 23:30 应用程序
drwxr-xr-x@ 9 我的管理员 306 Oct 30 23:36 开发人员
drwxr-xr-x@ 5 我的管理员 170 Oct 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 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 173 21:50 XPC服务
drwxr-xr-x@ 3 我的管理员 102 Oct 30 23:10 _CodeSignature
-rw-r--r--@ 1 我的管理员 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.
总计 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 我的管理员 238 Oct 30 23:46 usr
请帮忙。
回答by M.Y.
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.
说明:
在阅读时,man xcrun
我注意到有一个 DEVELOPER_DIR 环境变量优先于 xcode-select。所以在这里我们将该变量设置为正确的路径。
回答by Nanda
Run this to set your Developer folder:
运行它来设置你的 Developer 文件夹:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
回答by Fawaz
回答by Danut Pralea
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!
- 重新安装Xcode
- 改变了各种路径
- 重新安装开发者工具
- 我什至重新安装了操作系统!
Downloading the latest GIT version from Heredid the trick though.
不过,从Here下载最新的 GIT 版本可以解决问题。
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.
请注意:重新启动当前的终端窗口 & 这不是临时解决方案。
回答by Mahesh Chaudhari
Do the following steps
执行以下步骤
Open Xcode
打开 Xcode
Preferences->Locations->Command Line Tools-> Select Xcode Version
首选项->位置->命令行工具->选择Xcode版本