按照官网(https://brew.sh/index_zh-cn.html)给的命令:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

执行后 报错:

  xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
   Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools

从报错来看,是说 /Library/Developer/CommandLineTools 不是 xcode-select 的有效路径

那么要做的就有两件事:

1.找到 xcode-select的有效路径

  2.使用有效路径替换 https://raw.githubusercontent.com/Homebrew/install/master/install 文件中的 /Library/Developer/CommandLineTools

1.查找 xcode-select的有效路径

使用命令:xcode-select 查看其用法

userNameMacBook-Pro:test userName$ 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

执行:xcode-select -p找到真正的路径,输出

  /Applications/Xcode.app/Contents/Developer 即 xcode-select的有效路径

2.使用有效路径:/Applications/Xcode.app/Contents/Developer

替换 https://raw.githubusercontent.com/Homebrew/install/master/install 文件中的 /Library/Developer/CommandLineTools

将https://raw.githubusercontent.com/Homebrew/install/master/install 内容复制下来,将第306和315行两处的/Library/Developer/CommandLineTools

改为/Applications/Xcode.app/Contents/Developer 并保存名为 install的文件

3.进入保存的install文件目录下,执行

ruby -e "$(cat install)"即可

mac 安装homobrew 报错解决的更多相关文章

  1. Mac安装MySQL-python报错解决

    Mac安装MySQL-pyhton报错 今天在Mac上安装MySQL-python报错,搜遍网络都说什么mysql config路径问题,但是都不行. 解决方案 一开始遇到的问题是: Complete ...

  2. python︱模块加载(pip安装)以及pycharm安装与报错解决方式

    每每以为攀得众山小,可.每每又切实来到起点,大牛们,缓缓脚步来俺笔记葩分享一下吧,please~ --------------------------- 准备放下R开始学python,真是痛苦,因为找 ...

  3. 安装APK报错解决方法【转】

    本文转载自:http://blog.csdn.net/zy1235678/article/details/38122827 adb install xxx.apk 报错,安装APK报错:INSTALL ...

  4. python 2.7安装pygame报错解决办法pygame-1.9.4-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform.

    python下载python安装包 https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame 下载完后进入cmd命令行执行安装,报错: pygame-1.9 ...

  5. Mac安装MAT报错问题

    安装mat报错,提示在/.eclipse/1528649425_macosx_cocoa_x86_64/configuration/1539332382530.log路径下查看错误日志, 原因是/pr ...

  6. darknet的安装及报错解决

    darknet 是YOLO网络的一个框架,安装见官网:https://pjreddie.com/darknet/ 跟着步骤就可以安装好了. 由于官网是全英文的,所以本文根据官网进行中文释义. 本人在按 ...

  7. 【Django】Mac 安装pip3-install-mysqlclient 报错

    1.首先在pip3-install-mysqlclient时报错 mysql_config not found 2.逛了一些博客 让安装mysql或者mysql-connector-c 我安装了后者还 ...

  8. hp安装oracle报错解决

    hpux上安装oracle 11gR2刚开始报错:集群验证框架内部发生了错误 解决办法http://www.it165.net/database/html/201509/14181.html 将文件后 ...

  9. ubuntu pip 安装django报错解决

    系统版本 ubuntu  Kylin 16.04 LTS       安装pip3 安装 Django 总是提示time out,无法安装. 逛了好多论坛终于遭到了解决办法,分享保存: sudo pi ...

随机推荐

  1. CSS使用学习总结

    尽量少使用类,因为可以层叠识别,如: .News h3而不必在h3上加类 <div class=”News”> <h3></h3> <h2></h ...

  2. django 关闭debug模式,报500错误

    今天关闭了程序的debug模式,结果提示500错误.但是启动debug模式,又运行正常. Server Error (500) 上网查了以后,发现django1.5版本的要设置ALLOWED_HOST ...

  3. 【转自IT虾米网:www.itxm.net】外部应用和drools-wb6.1集成解决方案

    一.手把手教你集成外部应用和drools workbench6.1 1.         首先按照官方文档安装workbench ,我用的是最完整版的jbpm6-console的平台系统,里面既包含j ...

  4. MongoDB C#驱动中Query几个方法

    Query.All("name", "a", "b");//通过多个元素来匹配数组 Query.And(Query.EQ("nam ...

  5. MySQL技术内幕:SQL编程 第2章 数据类型 读书笔记

    2.1 类型属性 2.1.1 UNSIGNED 数字无符号化, INT的值 -2147483648 ~ 2147483647  INT UNSIGNED的值 0 ~ 4294967295 int a ...

  6. C# string.Format("{0:C3}", 2)

  7. UE4 Run On Server与Run on owning client

  8. Qt选择文件对话框-中文路径-转std::string

    #include <QFileDialog>#pragma execution_character_set("utf-8") QString path = QFileD ...

  9. N小时改变一次url时间戳的方法

    //为url添加时间戳//time 为多长时间改变一次时间戳,以小时为单位function setTimeStamp(url, time){    var time = time || 4,      ...

  10. ubuntu 14.04 返回到经典桌面方法

    1.打开终端,运行下面命令:sudo apt-get install gnome-session-fallback 2.重启机器,选择gnome,然后登录