赞
踩
title: Homebrew安装失败解决方法
tags: Mac, Homebrew
首先我们执行了官方命令
/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
这个目录
使用命令安装Tools
xcode-select --install
注意:有时候执行这个命令会出现错误 :不能下载该软件,因为网络出现问题。
这时候我们可以在https://developer.apple.com/download/more/
上面手动下载安装Command_Line_Tools
安装好tools后我们再次执行官方命令
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
成功安装
我们首先用命令查看本地tools的位置
xcode-select -p
一般会得到/Applications/Xcode.app/Contents/Developer
接着下载官方脚本https://raw.githubusercontent.com/Homebrew/install/master/install
并保存为 install.sh
文件
把文件中的/Library/Developer/CommandLineTools
替换成你刚刚得到的路径/Applications/Xcode.app/Contents/Developer
并保存
最后使用命令执行脚本
/usr/bin/ruby -e "$(cat install.sh)"
注意: install.sh 要CD到你存放的路径来执行
或者直接指明路径,如/usr/bin/ruby -e "$(cat /Users/clown/Downloads/install.sh)"
成功安装
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。