Mac-Tools-Homebrew Quick Install/Uninstall/Use

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


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 --helpCheck 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:

Xcode tools software update

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):

  1. Download the script, change the content of the script, and then install it

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:

  1. brew switch openssl 1.0.2t
  2. 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
  1. 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
  1. If none of the above works, uninstall Homebrew and reinstall it again. Note: brew listCheck the installed applications first, and install the applications after reinstalling.

问题2: fatal: not in a git directory Error: Command failed with exit 128: git

  1. 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 use brew doctorto view the Warning information and the solution given under Warning.

Guess you like

Origin blog.csdn.net/code_nn/article/details/125612758