2013-01-15 46 views
3

的Mac OS X 10.8.2
的Xcode 4.5.2(安裝在/Applications/Xcode.app)xcrun找不到Xcode的路徑

試圖
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 

共0
drwxr-XR-X @ 16我的管理員544 10月30日23:38內容

ls -l /Applications/Xcode.app/Contents 

總24
drwxr-xr-x @ 8我的管理員272 10月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 10月19日14點22分的Info.plist
drwxr-XR-X @ 3我的管理員102 8月5日8點03分庫
drwxr-XR-X @ 3我的管理員102年10月30 23:10的MacOS
drwxr-XR -x @ 16我的管理員544 Oct 30 23:37 OtherFrameworks
-rw-r - r - @ 1我的管理員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我的管理員578 Oct 30 23:46 SharedFrameworks
drwxr-xr-x @ 4 my admin 136 Oct 17 21:50 XPCServices
drwxr-xr-x @ 3我的管理員102 Oct 30 23 :10 _CodeSignature
-rw-R - R的 - @ 1我的管理員523年10月30 23:10 version.plist

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

總0
drwxr-XR-X @ 3我的管理員102 8月5日07:29文檔
drwxr-xr-x @ 7我的管理員238 12月20日21:09圖書館
drwxr-xr-x @ 7我的管理員238 Oct 30 23:46 Makefiles
drwxr-XR-X @ 5我的管理員170年10月30個23:28平臺
drwxr-XR-X @ 3我的管理員102 10月10日1點37分工具鏈
drwxr-XR-X @ 22我的管理員748年10月30 23:31工具
drwxr-xr-x @ 7我的管理員238 10月30 23:46 usr
請幫忙。

回答

20

固定!在終端:

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

說明:
在閱讀man xcrun我注意到,有DEVELOPER_DIR環境變量,需要的Xcode選的優先級。所以我們在這裏設置這個變量來糾正路徑。

+1

這個答案可能不是想法,因爲xcode-select應該能夠自動配置路徑而不需要維護額外的環境變量。看到@Nanda的答案 – Purrell

+0

爲了澄清,你可以這樣做:'''''''''''''''''''''''''' – Jas

10

運行此設置你的開發者文件夾:

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer 
+0

我得到'sudo:/ user/bin/xcode-select:command not found' –

+0

謝謝,爲我效勞!僅導出路徑不成功。 – abimelex

1

我已經嘗試了所有可能的選項:

  • 重新安裝的Xcode
  • 改變了所有種類的路徑
  • 重安裝開發人員工具
  • 我甚至重新安裝了操作系統!

Here下載最新的GIT版本,但做到了。

我認爲這是升級操作系統的錯誤。我認爲一個乾淨/格式重新安裝也會修復它(因爲所有的設置都被保留)

請注意:重新啓動當前的終端窗口&這不是一個臨時解決方案。

+0

重新啓動終端爲我做了,謝謝 – miphe