本質原因是mac10.15安全等級提升,不允許遠程執行腳本,那麼解決方法就是用本地進行執行:
brew官方網站:https://brew.sh/
正常情況下,按照官網這行命令就解決了,但報錯如題目所示
那換一種思路:把上面後半段網址的內容複製到本地:https://raw.githubusercontent.com/Homebrew/install/master/install.sh
1、先在本地創建一個文本 例如叫brew_install的文件
2、把上面的內容全部複製進去
3、用終端執行:
/bin/bash brew_install
如果提示沒有同意xcode,按提示來就行,最後agree一下
4、慢慢等待按照,界面如下(我已經開代理了速度還是這麼慢)
5、如果嫌棄慢,可以更改鏡像,在原文中找到
BREW_REPO="https://github.com/Homebrew/brew"
整句替換爲
BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"
安裝完成後,可以繼續設置鏡像地址,如果有代理可以忽略:進入下面的 Taps 目錄,clone homebrew-core
cd /usr/local/Homebrew/Library/Taps/homebrew (如果沒有homebrew,新建homebrew文件夾)
git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
把homebrew repo切換爲清華鏡像
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update
可以參考簡書鏈接:https://www.jianshu.com/p/fdf7e316f096