macOS HomeBrew更換源 brew常用命令說明


homebrew本身就是一個git倉庫。使用homebrew安裝軟件包時,會自動先下載軟件包,然后解壓安裝,但有時候下載會卡住,或者很慢,這個時候有以下幾種方法:

1.臨時的終止update,先control+c,停掉當前update,安裝繼續

2.更改更好用的git遠程倉庫

替換homebrew默認源(源代碼倉庫)

cd "$(brew --repo)"
git remote set-url origin git://mirrors.ustc.edu.cn/brew.git

 如圖:

 

替換homebrew-core源(核心軟件倉庫)

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git

 如圖:

 

替換homebrew-bottles(預編譯二進制軟件包)

bash用戶:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.bash_profile

zsh用戶:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

3.通過其他工具先將所需的軟件包下載下來,注意版本一定要對應,homebrew放置軟件包源碼的路徑為/Library/Caches/Homebrew/,只要你將所需要的軟件包下載正 確的版本,放置在此目錄下,那么再使用brew install xxx的時候,brew就能直接安裝了,有時候brew install xxx卡在下載界面,這招很管用。

 

首先執行brew --help或者man brew都會有下面的列表

Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]

Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA

Contributing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh

或者

NAME
       brew - The missing package manager for macOS

SYNOPSIS
       brew --version
       brew command [--verbose|-v] [options] [formula] ...

DESCRIPTION
       Homebrew is the easiest and most flexible way to install the UNIX tools
       Apple didn't include with macOS.

ESSENTIAL COMMANDS
       For the full command list, see the COMMANDS section.

       With --verbose or -v, many commands print extra debugging  information.
       Note that these flags should only appear after a command.

       install formula
              Install formula.

       uninstall formula
              Uninstall formula.

反正都是介紹brew命令的使用。個人覺的學會看這個,比看別人的博客來的快。

那么介紹一下常用的命令:

brew –help             #查看brew的幫助

brew install git        #安裝git軟件

brew uninstall git     #卸載git軟件

brew search git        #搜索git軟件

brew list                   #顯示已經安裝軟件列表

brew update            #更新軟件,把所有的Formula目錄更新,並且會對本機已經安裝並有更新的軟件用*標明。

brew upgrade git      #更新某具體軟件

brew [info | home] [FORMULA…] #查看軟件信息

brew cleanup git       #單個軟件刪除,和upgrade一樣

brew cleanup           #刪除所有

brew outdated         #查看那些已安裝的程序需要更新

brew home  *          #用瀏覽器打開

brew info *              #顯示軟件內容信息

brew deps *             #顯示包依賴

brew config             #查看brew配置

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM