在Mac(M1芯)上安裝 Homebrew及Warning解決20230328

一、安裝軟件
去https://brew.sh/
在主頁上找到上圖的代碼復制到終端(我直接放下面了 更新日期2023年3月28日)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
3. 會出現以下內容,直接按鍵盤上的RETURN
或ENTER
按鈕繼續(xù):
==> 正在檢查 `sudo` 訪問權限(可能需要您的密碼)...
(電腦鎖屏的密碼,盲輸)
密碼:
==> 該腳本將安裝:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/ homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> 以下新目錄將是創(chuàng)建:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Frameworks按 RETURN/ENTER 繼續(xù)或任何其他鍵中止:
4. 根據網速,可能需要一些時間。
若出現警告,則進入第二部分。(M1芯片一般會警告)
????????(前省略)
···
????????
????????HEAD is now at 12e7787eb Merge pull request #15058 from apainintheneck/fix-readall-no-simulate
????????Warning: /opt/homebrew/bin is not in your PATH.
????????? Instructions on how to configure your shell for Homebrew
????????? can be found in the 'Next steps' section below.
????????==> Installation successful!
????????
????????==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
????????Read the analytics documentation (and how to opt-out) here:
????????? https://docs.brew.sh/Analytics
????????No analytics data has been sent yet (nor will any be during this install run).
????????
????????==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
????????? https://github.com/Homebrew/brew#donations
????????
????????==> Next steps:
????????- Run these two commands in your terminal to add Homebrew to your PATH:
????????? ? (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/wangqian/.zprofile
????????? ? eval "$(/opt/homebrew/bin/brew shellenv)"
????????- Run brew help to get started
????????- Further documentation:
????????? ? https://docs.brew.sh
翻譯(渣機翻幫助理解):
(前省略)
警告:/opt/homebrew/bin 不在您的路徑中。
?有關如何為 Homebrew 配置 shell 的說明,
?請參見下面的“后續(xù)步驟”部分。
==> 安裝成功!==> Homebrew 啟用了匿名聚合公式和木桶分析。
在此處閱讀分析文檔(以及如何選擇退出):https:
?//docs.brew.sh/Analytics
尚未發(fā)送任何分析數據(在此安裝運行期間也不會發(fā)送任何數據)。==> Homebrew 完全由無償志愿者運行。請考慮捐贈: https:
?//github.com/Homebrew/brew#donations==> 后續(xù)步驟:
- 在您的終端中運行這兩個命令以將 Homebrew 添加到您的 PATH 中:
? ?echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/yourname/.zprofile
? ?eval " $(/opt/homebrew/bin/brew shellenv)"
- 運行 brew help 開始
- 更多文檔:
? ?https://docs.brew.sh
二、問題說明及操作:
1.說明:類似于windows系統下的配置環(huán)境變量。
要按照“后續(xù)步驟”并將 Homebrew 添加到?PATH,以便brew
從終端的任何位置運行。如果不這樣做,每次運行時都會看到brew
:
$ brew install something
zsh:找不到命令:brew
2、操作
粘貼入終端并運行:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<willshowyouruserdirectory>/.zprofile
再粘貼入終端并運行:
eval "$(/opt/homebrew/bin/brew shellenv)"
完成。