官方自帶源基本不能用,推薦國內源
homebrew國內源安裝方法:
終端輸入以下命令,輸入序號1,輸入Y,輸入密碼
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
安裝過程記錄
Last login: Wed Sep 15 09:11:16 on ttys000 (base) localhost:~ userxxx$ /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" 開始執行Brew自動安裝程序 [cunkai.wang@foxmail.com] ['2021-09-15 09:37:28']['10.14'] https://zhuanlan.zhihu.com/p/111014448 請選擇一個下載鏡像,例如中科大,輸入1回車。 源有時候不穩定,如果git克隆報錯重新運行腳本選擇源。cask非必須,有部分人需要。 1、中科大下載源 2、清華大學下載源 3、北京外國語大學下載源 4、騰訊下載源(不推薦) 5、阿里巴巴下載源(不推薦 缺少cask源) 請輸入序號: 1 你選擇了中國科學技術大學下載源 !!!此腳本將要刪除之前的brew(包括它下載的軟件),請自行備份。 ->是否現在開始執行腳本(N/Y) Y --> 腳本開始執行 Mac os設置開機密碼方法: (設置開機密碼:在左上角蘋果圖標->系統偏好設置->用戶與群組->更改密碼) (如果提示This incident will be reported. 在用戶與群組中查看是否管理員) ==> 通過命令刪除之前的brew、創建一個新的Homebrew文件夾 請輸入開機密碼,輸入過程不顯示,輸入完后回車 Password: 開始執行 ---備份要刪除的/usr/local/Homebrew到系統桌面.... cp: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/fuse/osxfuse.pc: No such file or directory cp: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/fuse/fuse.pc: No such file or directory ---/usr/local/Homebrew 備份完成 -> 創建文件夾 /usr/local/Homebrew 運行代碼 ==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew 此步驟成功 運行代碼 ==> /usr/bin/sudo /bin/chmod -R a+rwx /usr/local/Homebrew 運行代碼 ==> /usr/bin/sudo /usr/sbin/chown dugh /usr/local/Homebrew 運行代碼 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew ---備份要刪除的/Users/dugh/Library/Caches/Homebrew到系統桌面.... ---/Users/dugh/Library/Caches/Homebrew 備份完成 git version 2.20.1 (Apple Git-117) 下載速度覺得慢可以ctrl+c或control+c重新運行腳本選擇下載源 ==> 克隆Homebrew基本文件 ------- 等待結束 ------ Brew自動安裝程序運行完成 國內地址已經配置完成 桌面的Old_Homebrew文件夾,大致看看沒有你需要的可以刪除。 初步介紹幾個brew命令 本地軟件庫列表:brew ls 查找軟件:brew search google(其中google替換為要查找的關鍵字) 查看brew版本:brew -v 更新brew版本:brew update 安裝cask軟件:brew install --cask firefox 把firefox換成你要安裝的 歡迎右鍵點擊下方地址-打開URL 來給點個贊 https://zhuanlan.zhihu.com/p/111014448 重啟終端 或者 運行 source /Users/userxxx/.bash_profile 否則可能無法使用
有疑問訪問作者網站:https://zhuanlan.zhihu.com/p/111014448