HomeBrew installation

HomeBrew Chinese Address

Through the above link to get the installation address, the address may change, you need to get used again:

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

Mounting

Command line installation

If the network flow directly from the command line implementation of the above command.

Manually download and install

If you compare the network card, such as my network, it would need to use the manual download installed.

Download the install file

Open in the browser https://raw.githubusercontent.com/Homebrew/install/master/installthis period, and then saved to a local for the install.rbfile.

Replace BREW_REPO Mirror address

Alternatively install.rbthe BREW_REPOsource USTC, commented here, then add one line.

#BREW_REPO = "https://github.com/Homebrew/brew".freeze
BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze

Then in the command line ruby install.rb, note the directory where you want to switch to install.rbthe directory, then you will see

$ ruby install.rb 
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/Homebrew

Press RETURN to continue or any other key to abort

Then press Enter to continue, after the meal operation, we will be stuck here when performing the following:

==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...

The case will net more cards here fails, we will not wait, direct ctrl + cto end the command.

Then we enter the following command at the command line:

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

This command is to download the source from USTC homebrew-core

Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 5032, done.
remote: Compressing objects: 100% (4835/4835), done.
remote: Total 5032 (delta 49), reused 721 (delta 6)
Receiving objects: 100% (5032/5032), 4.03 MiB | 2.49 MiB/s, done.
Resolving deltas: 100% (49/49), done.
Checking out files: 100% (5050/5050), done.

Here HomeBrewregarded as the installation is complete.

Source Settings

Installation also need to set the source, setting up the source we can use more smoothly. As for why so many want to set the role of sources, and these sources, please quote reference links at the end of the text.

Replace brew.git:

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

Replace homebrew-core.git:

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

Homebrew Bottles source settings:

对于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

USTC set the reference source link

brew, brew-core, brew-bottles is what this comparison clearly

macOS incomplete package management tool Homebrew Guide

Reference links (this write a bit messy, so I just wrote an article)

Guess you like

Origin www.cnblogs.com/haha1212/p/11271255.html