Homebrew package manager

Posted by Taro on Sun, 15 Sep 2019 14:49:19 +0200

Homebrew Package manager

[toc]

I. Introduction

Homebrew It is a package manager under Mac OS X, which is equivalent to yum and apt-get under Linux. Homebrew It is easy to download and install applications, and it is no longer necessary to search for various installation packages by hand.

Be careful: Homebrew With Mac OS X MacPorts Package Manager is incompatible if installed MacPorts It needs to be unloaded first.

Two, installation

Install Xcode command line tools

Homebrew The package manager relies on Xcode's command line tool Command Line Tools (CLT) for Xcode, which can be obtained in two ways:

  • Install only the Xcode command line tool and execute the following commands at the terminal:

    xcode-select --install

  • Install the entire Xcode directly in the AppStore (if developed with Xcode)

install Homebrew

Execute the following commands directly in the terminal to execute installation.

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

View after installation Homebrew Version information

brew --version

Replacement of Homebrew Installation Source

The installation source of Tsinghua University Open Source Software Mirror Station is replaced here, and the following commands can be executed directly at the terminal:

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

brew update

If you need to replace the binary precompiled package source, you can execute the following commands:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile

source ~/.bash_profile

Restoration operation can be referred to. https://mirrors.tuna.tsinghua.edu.cn/help/homebrew

4. Disabling automatic updates

Homebrew automatically updates all applications by default when installing applications. It takes a long time to update. You can choose to shield automatic updates:

echo 'export HOMEBREW_NO_AUTO_UPDATE=true' >> ~/.bash_profile

source ~/.bash_profile

Installation of brew-cask

Brew-case is a Homebrew enhancement tool for downloading binary precompiled packages (Chrome, sourcetree, etc.) for GUI applications that install Mac OS X.

Github address is: https://github.com/xyb/homebrew-cask-completion

Brew-case can be installed with the following commands:

brew install homebrew/completions/brew-cask-completion

perhaps

brew tap homebrew/completions
brew install brew-cask-completion

Common orders

Enter the brew command to see the common usage of brew. The use of brew case is roughly the same as that of brew.

Example usage:
brew search     Search packet
brew info       View package information
brew install    Installation package
brew update     To update brew
brew upgrade    Update package
brew outdated   View available updates
brew uninstall  Unloading Application Pack
brew list       Installed List

brew config     View configuration information
brew doctor     Diagnosis

brew help       View Help Information

Topics: Programming brew git xcode Mac