柚子快報激活碼778899分享:MacOS安裝Homebrew
柚子快報激活碼778899分享:MacOS安裝Homebrew
目錄
一、Homebrew介紹
1、Homebrew的好處
2、安裝方式
方法一:brew官方安裝
方法二:brew 鏡像安裝腳本(親測最快速最有效)
二、安裝步驟
1、安裝國內(nèi)鏡像
2、配置路徑
3、必備配置、按需配置
1.必備設置
2.按需設置
4、Homebrew 安裝時如何避坑
1.若出現(xiàn) Error: Checksum mismatch.
2.若卡在了Cloning into...
三、Homebrew組成
四、Homebrew 基本用法有哪些
一、Homebrew介紹
1、Homebrew的好處
macOS的包管理器,安裝brew之后,僅需執(zhí)行相應的命令,就能下載安裝需要的軟件包,可以省掉自己去下載、解壓、拖拽(安裝)等繁瑣的步驟。
比如nginx反向代理服務器等,打開終端執(zhí)行以下命令即可安裝:
brew install 某某包名字
2、安裝方式
方法一:brew官方安裝
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
這時很可能會出現(xiàn)一個問題: 要么下載很慢,要么直接提示這個
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
不要慌,這是因為官方安裝包的下載地址在國外,被限制了 。
此時需要換一種科學高效的安裝方法。
方法二:brew 鏡像安裝腳本(親測最快速最有效)
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
該腳本用了中科大鏡像加速訪問,僅修改倉庫地址部分,不會產(chǎn)生安全隱患。 關(guān)于中科大所提供的 Homebrew 鏡像服務?https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git
二、安裝步驟
1、安裝國內(nèi)鏡像
該腳本用了中科大鏡像加速訪問,僅修改倉庫地址部分,不會產(chǎn)生安全隱患。 關(guān)于中科大所提供的 Homebrew 鏡像服務?https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
2、配置路徑
chenmingsong@chenmingsongdeMacBook-Pro ~ % echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/chenmingsong/.zprofile
chenmingsong@chenmingsongdeMacBook-Pro ~ % eval "$(/opt/homebrew/bin/brew shellenv)"
3、必備配置、按需配置
前面已經(jīng)提到,Homebrew通常用來下載軟件的,但它在安裝軟件時非常慢。為了提升安裝速度,需要更改 Homebrew 的安裝源,將其替換成國內(nèi)鏡像。
這里用的是由中科大負責托管維護的 Homebrew 鏡像。其中,前兩個為必須配置的項目,后兩個可按需配置。
1.必備設置
替換 brew.git:
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
替換 homebrew-core.git:
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
2.按需設置
替換 homebrew-cask.git:
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
替換homebrew-bottles:
首先要先區(qū)分你的mac用哪種終端工具,如果是 bash,則執(zhí)行:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile
若是 zsh,則執(zhí)行:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc source ~/.zshrc
4、Homebrew 安裝時如何避坑
1.若出現(xiàn) Error: Checksum mismatch.
報錯代碼如下:
curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
Error: Checksum mismatch.
Expected: b065e5e3783954f3e65d8d3a6377ca51649bfcfa21b356b0dd70490f74c6bd86
Actual: e8a348fe5d5c2b966bab84052062f0317944122dea5fdfdc84ac6d0bd513c137
Archive: /Users/joyce/Library/Caches/Homebrew/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
To retry an incomplete download, remove the file above.
Error: Failed to install Homebrew Portable Ruby (and your system version is too old)!
Failed during: /usr/local/bin/brew update --force
這里是由Homebrew目錄下的portable-ruby-2.6.3_2.yosemite.bottle.tar.gz文件引起的安裝中斷,只需要到上面對應的路徑里,刪掉這個文件,重新執(zhí)行安裝命令即可:
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
2.若卡在了Cloning into...
由這里的龜速可斷定卡住了,立馬用Control + C中斷命令執(zhí)行,然后執(zhí)行以下命令:
cd "$(brew --repo)/Library/Taps/"
mkdir homebrew && cd homebrew
git clone git://mirrors.ustc.edu.cn/homebrew-core.git
三、Homebrew組成
主要由四個部分組成: brew,homebrew-core ,homebrew-cask,homebrew-bottles
它們對應的功能如下:
組成功能Homebrew源代碼倉庫homebrew-coreHomebrew 核心源homebrew-cask提供macos應用和大型二進制文件的安裝homebrew-bottles預編譯二進制軟件包
四、Homebrew 基本用法有哪些
// 查詢:
brew search 軟件名
// 安裝:
brew install 軟件名
// 卸載:
brew uninstall 軟件名
// 更新 Homebrew:
brew update
// 查看 Homebrew 配置信息:
brew config
注:使用官方腳本同樣會遇到uninstall地址無法訪問問題,可以替換為下面腳本:
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/uninstall)"
參考鏈接:
macOS安裝Homebrew教程從入門到入土_dlwlrma2022的博客-CSDN博客_homebrew安裝教程Homebrew是個啥?怎么用?講人話!macOS的包管理器,安裝brew之后,僅需執(zhí)行相應的命令,就能下載安裝需要的軟件包,可以省掉自己去下載、解壓、拖拽(安裝)等繁瑣的步驟。比如nginx反向代理服務器等,打開終端執(zhí)行以下命令即可安裝:brew install 某某包名字這么牛的工具怎么安裝?打開訪達 - 實用工具 - 終端 輸入以下命令方法一:brew官方安裝/bin/bash -c "$(curl -fsSL https://raw.githubusercontenthttps://blog.csdn.net/m0_60845208/article/details/124246478
柚子快報激活碼778899分享:MacOS安裝Homebrew
推薦鏈接
本文內(nèi)容根據(jù)網(wǎng)絡資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。
轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。