Mac Homebrew three kinds of installation methods

There are several ways to install Homebrew online more are two, one is the official website of the recommended approach is a domestic alternative sources, these two methods are limited by GreatWall, often can not be used.
Recommended way to use a third way, a direct clone.

1. official website recommended way

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

2. Replace domestic source way

Operation roughly as follows:
1, download the install files from the official website and named brew_install;
2, modify the source file in the install information for domestic source;
3, do ruby brew_install install;
this way there are many online tutorials, not repeat them here, refer to tutorial 1

3. git clone manner

For most people, this is the way I recommend the way, the risk of the wall does not exist.
If this is the first installation in accordance with steps; if installed before using other means, some of the existing directory may need to manually delete it, and then follow the steps.

1, first create a directory Homebrew

sudo mkdir /usr/local/Homebrew

2, execution clone

sudo git clone https://mirrors.ustc.edu.cn/brew.git /usr/local/Homebrew

3, create a soft link brew instructions

sudo ln -s /usr/local/Homebrew/bin/brew /usr/local/bin/brew

4. Create a directory for core

sudo mkdir -p /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

5, execution clone

sudo git clone https://mirrors.ustc.edu.cn/homebrew-core.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

6, change the owner of the Homebrew

sudo chown -R $(whoami) /usr/local/Homebrew

7, create a directory other needs

sudo mkdir -p /usr/local/Cellar /usr/local/Frameworks /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var/homebrew/linked

8, for the newly created directory changes owner

sudo chown -R $(whoami) /usr/local/Cellar /usr/local/Frameworks /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/var/homebrew/linked

9, here, BREW installation has been completed, perform the following update detection &

brew update
brew doctor

10, try to install it and start a nginx

brew install nginx
brew services start nginx

Open your browser and enter the address localhost: 8080, you can see the nginx has been successfully installed and running up.

Published 105 original articles · won praise 58 · views 410 000 +

Guess you like

Origin blog.csdn.net/ljl890705/article/details/104744969