按照官网(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. 通过jd2chm工具将html文档生存chm文档方法

    1.下载jd2chm.exe工具 2.下载后解压缩后先安装htmlhelp.exe 3.将jd2chm.exe文件拷贝到index.html所在文件夹中 4.打开命令行进入到index.html所在文 ...

  2. jQuery.ajax实现根据不同的Content-Type做出不同的响应

    使用H5+ASP.NET General Handler开发项目,使用ajax进行前后端的通讯.有一个场景需求是根据服务器返回的不同数据类型,前端进行不同的响应,这里记录下如何使用$.ajax实现该需 ...

  3. Oracle 11gR2 11.2.0.1 ( 11.2.0.1的BUG?):ohasd不能正常启动:ioctl操作:npohasd的问题:【chmod a+wr /var/tmp/.oracle/npohasd】

    问题1:执行安装,编译成功后,执行asmca时,失败,无法成功创建后台相关服务 问题2:os系统重启后,ohasd无法正常启动,css服务失败 原因:11.2.0.1的BUG:/var/tmp/.or ...

  4. The Rox Java NIO Tutorial

    FQ之后访问 http://rox-xmlrpc.sourceforge.net/niotut/

  5. SQLServer------插入数据时出现IDENTITY_INSERT错误

    详细错误信息: 当 IDENTITY_INSERT 设置为 OFF 时,不能为表 'Student' 中的标识列插入显式值. 原因: 表中存在某个字段是自动增长的标识符 解决方法: set IDENT ...

  6. ALM在win7/IE8下无法浏览

    操作系统WIN7 64位. 安装完ALM后,用IE8打开查看,没有登录界面,提示需要安装东西. 按照提示安装,没有响应,然后到网上查了一下资料: ALM/QC11.0在win8/IE11下无法浏览 页 ...

  7. 多进程模块:multiprocessing

    多进程: (1) 前面我们学习的多线程,其实算不上真正的多线程,即使你开了很多个线程,在同一时间内只能有一个CPU核数来处理一个线程(2) 在 python 中,多进程算得上是真正的多线程,假设你的C ...

  8. 如何在CLI命令行下运行PHP脚本,同时向PHP脚本传递参数?

    <?php/* //命令行输入输出流fwrite(STDOUT,"Enter your name:"); $name = trim(fgets(STDOUT)); fwrit ...

  9. 动态调整UITableViewCell高度的实现方法

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPa ...

  10. 《转载》POI导出excel日期格式

    参考帖子: [1]http://www.ithao123.cn/content-2028409.html [2]http://javacrazyer.iteye.com/blog/894850 再读本 ...