Welcome to Markdown Editor
Tip: After the article is written, the table of contents can be automatically generated. How to generate it can refer to the help document on the right
Mac - Tools - Homebrew Tutorials
foreword
Installation environment: macOS Big Sur 11.6.7.
Homebrew has not been installed before, check the method, open Terminal.app, enter the command brew --version
, and check whether brew is available.
Official website: The address , installation and other operations are explained on the official website.
brew --help
Check out the commands supported by homebrew.
1. Installation
1. Install the front
In order to install Homebrew, you need to have the Xcode command line tools installed. If you've never used Terminal on a Mac, you most likely need to install it. Paste the following command into Terminal to install Xcode:
xcode-select --install
If the command line tools are not installed, a popup will appear asking for your permission to install them. Click Install and wait for the installation to complete.
If the tool is already installed, Terminal will display a message that it is already installed and the update is from Software Update. The software update can be viewed through the graphical interface, the operation steps: -> System Preferences -> Software Update, as shown in the figure below:
2. Install Homebrew
To install Homebrew, open a terminal and paste the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Depending on each person's network environment, it may not be possible to connect to the official website for installation, or the installation speed is extremely slow. You can paste the following command in the terminal:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Or choose another installation method (thanks to the domestic source, of course the foolish installation above is recommended):
3. Uninstall Homebrew
Uninstalling Homebrew is very similar to how it was installed. Open a terminal and paste the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
The script will show you what it will remove and ask if you want to continue uninstalling Homebrew. Type "y" to continue uninstalling.
Note: The above operation will uninstall every package you installed, for example, if you used it before brew install git
, git will not be available after uninstalling.
At the end of the uninstall, Brew will give you a message like this:
The following possible Homebrew files were not deleted.
/opt/homebrew/...
/opt/homebrew/...
/opt/homebrew/...
...
You may wish to remove them yourself.
The paths of Inter’s Mac and M1’s Mac may be different, delete the folder in the prompt. Use rm -rf [path]
, of course, can also be deleted graphically, open finder -> command+shift+G -> reach the directory where the folder is located, and delete the folder.
2. Summary of problems encountered
Question 1: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
After installing mysql, an error occurred when using
mysql -u [userName] -p
to connect to the local database.
Summary of solutions:
brew switch openssl 1.0.2t
- Install openssl and associate lib
brew install rbenv/tap/[email protected]
ln -sfn /usr/local/Cellar/[email protected]/1.0.2t /usr/local/opt/openssl
- openssl has been installed, uninstall and reinstall
brew update && brew upgrade
brew uninstall openssl
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
- If none of the above works, uninstall Homebrew and reinstall it again. Note:
brew list
Check the installed applications first, and install the applications after reinstalling.
问题2: fatal: not in a git directory Error: Command failed with exit 128: git
- Generally, when there is a problem with the installation of
brew install
the command , it is generally a problem with the configuration of brew. You can usebrew doctor
to view the Warning information and the solution given under Warning.