Xcode其本身路径不对导致的错误

问题例如:error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select to change

个人是因为装Alcatraz的时候失败了,提示error如下:
Xcode Command Line Tools are not currently installed, and are required to run Alcatraz.

后来想起的我的 xcode7.2 是从朋友那边拷过来的,或许是因xcode本身的路径不对导致的问题。

下面介绍如何使用终端改xcode的路径:

1、打开终端
//确认当前工作位置
appledeMacBook-Pro-3:~ 09$ pwd
/Users/apple

//由于忘记具体执行代码 输入 xcode-select获取提示
appledeMacBook-Pro-3:~ 09$ xcode-select

----------
xcode-select: error: no command option given
Usage: xcode-select [options]
----------
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example, 
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  --install                   open a dialog for installation of the command line developer tools
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path
----------

//发现-p是获取 xcode现在路径;-s是转移到对应路径

appledeMacBook-Pro-3:~ 09$ xcode-select -p
/Users/apple/Documents/Xcode 2.app/Contents/Developer
//果然 xcode 不在应用程序中的位置

//ls 相应路径确认存在
appledeMacBook-Pro-3:~ 09$ ls /Applications/Xcode.app/Contents/Developer/
Applications    Library     Platforms   Tools
Documentation   Makefiles   Toolchains  usr

//-s 相应路径 将 xcode 转移到对应路径
appledeMacBook-Pro-3:~ 09$ xcode-select -s /Applications/Xcode.app/Contents/Developer/

//这里给我报了个错误
----------
xcode-select: error: --switch must be run as root (e.g. sudo xcode-select --switch <xcode_folder_path>).
----------
//然后我复制它给我的命令 将路径写入

appledeMacBook-Pro-3:~ 09$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
//提示输入本机密码
//输入后成功。
发布了53 篇原创文章 · 获赞 4 · 访问量 4万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章