macOS安裝Homebrew

macOS安裝Homebrew

在MacOS安裝Homebrew的過程中可謂是一波三折,出現了常見的兩種報錯,一種是查看版本提示command not found,一種是failed to connection 503錯誤,最終解決了特此記錄以供參考。

安裝語句

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

檢測安裝

輸入brew --version查看brew的版本信息,顯示如下說明正常

安裝報錯command not found

輸入brew --version查看時卻提示command not found。

網上解決方法:

(1)打開bash_profile文件:sudo vim .bash_profile

(2) 添加語句:export PATH=$PATH:/usr/local/bin

(3) 使.bash_profile文件生效:source .bash_profile

(4)重新輸入安裝語句,然後查看版本。如果成功了,恭喜你。

安裝報錯curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation

參考博客

(1)打開網頁https://raw.githubusercontent.com/Homebrew/install/master/install

(2)將網頁中的內容複製下來,然後粘貼到一個新文件中,並將其命名爲brew_install.br

(3)打開終端,輸入curl,顯示如下內容表示正常。

(4)輸入「 ruby /Users/changechen/brew/brew_install.rb」,開始brew的安裝

中途需要輸入電腦密碼,然後顯示開始下載Homebrew

顯示installation successful!說明安裝成功了。

(5)檢測安裝,brew --version查看版本

成功!


happy ending!記得點個贊喲~