美文网首页
安装homebrew

安装homebrew

作者: 00d1ed2b53ae | 来源:发表于2019-02-18 22:43 被阅读9次

问题:网络下载不了

第一步,获取install文件

把官网给的脚本拿下来
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install

第二步,更改脚本中的资源链接,替换成清华大学的镜像

就是把这两句
BREW_REPO = “https://github.com/Homebrew/brew“.freeze
CORE_TAP_REPO = “https://github.com/Homebrew/homebrew-core“.freeze
更改为这两句
BREW_REPO = “https://mirrors.ustc.edu.cn/brew.git “.freeze
CORE_TAP_REPO = “https://mirrors.ustc.edu.cn/homebrew-core.git“.freeze
当然如果这个镜像有问题的话,可以换成别的

第三步,执行脚本

/usr/bin/ruby brew_install

问题:没权限

sudo chown -R $(whoami) /usr/local
把/use/local的owner換成自己,就有write權限了

whoami就是一個命令,會echo當前登錄用戶的名字。當然你知道自己的用戶名,比如jack,就直接

sudo chown -R jack /usr/local

没权限2

在MAC上安装homebrew进行安装,根据react native 文档步骤进行下去,同样在brew update的时候出现报错:Error: /usr/local must be writable! 错误,文档也给出解决办法(sudo chown -R (whoami) /usr/local),但是这种方法对于高版本的OS来说,是解决不了的,会报chown: /usr/local: Operation not permitted错误。后来在https://stackoverflow.com/questions/46459152/cant-chown-usr-local-for-homebrew-in-osx-10-13-high-sierra网页上给出了解决办法,下面简单总结一下:先卸载已安装的homebrew,命令如下:/usr/bin/ruby -e "(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"然后重新安装:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

下载卡住

停在==> Downloading and installing Homebrew...
创建文件 .gitconfig

添加内容

[http]
proxy = socks5://127.0.0.1:1080

相关文章

网友评论

      本文标题:安装homebrew

      本文链接:https://www.haomeiwen.com/subject/byktyqtx.html