Apple MacBookPro M1 安裝 brew(國內源)

南京小T發表於2020-12-16

1. 依賴

git

git安裝方法:

下載安裝包地址:https://git-scm.com/download/mac

Binary installer

Tim Harper provides an installer for Git. The latest version is 2.27.0, which was released 5 months ago, on 2020-07-22.

 

2. 準備目錄

M1之後,不能放到 /usr/local/bin目錄下了。要放到/opt目錄下 所以新建/opt目錄,cd /opt && sudo chmod -R 777 ./  授權給所有使用者所有許可權

 

3. 下載安裝指令碼

cd /opt && curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh > Homebrew.sh

4. 開啟指令碼修改安裝目錄

vim /opt/Homebrew.sh 

將 HOMEBREW_PREFIX的值修改成 HOMEBREW_PREFIX="/opt" 並儲存

5. 執行安裝命令

cd /opt && /bin/zsh Homebrew.sh 

建議選擇騰訊或者是阿里

6 . 配置環境變數

sudo vim /etc/profile 在最後一行新增 export PATH=$PATH:/opt/Homebrew/bin

source /etc/profile 

最好是重啟一下電腦,讓環境變數永遠生效

7. 執行brew -v

/opt/Homebrew/bin/brew: line 11: cd: /usr/local/Homebrew/bin: No such file or directory

Homebrew 2.5.6-74-g4e8d374-dirty

Homebrew/homebrew-core (git revision d1b6d; last commit 2020-10-19)

Homebrew/homebrew-cask (git revision 82aec0; last commit 2020-12-15)

 

相關文章