当前位置:   article > 正文

Xcode其本身路径不对导致的错误_mac安装homebrew时xcode路径不对

mac安装homebrew时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.
  • 1
  • 2
  • 3
  • 4

后来想起的我的 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/
//提示输入本机密码
//输入后成功。
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/334126
推荐阅读
相关标签
  

闽ICP备14008679号