Mac installation Homebrew tutorial

As a macOS user, it's a real shame if you haven't installed Homebrew, because it's a very powerful and useful package manager. However, installing Homebrew can sometimes be a bit of a challenge, but don't worry, the following are the steps I personally took to successfully install Homebrew for the first time, I hope it will help you.

  1. Open the Terminal application. You can find it in Launchpad, or use Spotlight to search for "terminal".
  2. In Terminal, copy and paste the following command, then press Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

This command will automatically download and install Homebrew.
3. The installation process may take some time, depending on your internet speed. During the installation process, you may need to enter your macOS user password to confirm the installation.
4. After the installation is complete, you should see a message that the installation was successful.

After the installation is complete, you can use Homebrew to install various packages and tools. For example, if you want to install Git, just run the following command in the terminal:

brew install git

Homebrew will automatically download and install Git. You can install other packages as needed by running the appropriate brew installcommand.

In addition, in order to optimize the installation speed, you can use the Homebrew mirror of the University of Science and Technology of China. Execute the following command in the terminal to set up the mirror:

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

This will set Homebrew's remote warehouse as the mirror address of University of Science and Technology of China, speeding up the download speed of packages.

Another way is to use the main body of the University of Science and Technology of China (I used this successfully)

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

As shown below
insert image description here
, Homebrew is a powerful package manager that provides many useful commands to install, update and manage packages. Here are some commonly used Homebrew commands:

  1. Install the package:
brew install <package>

This command is used to install the specified package, <package>replace with the name of the package to be installed.

  1. Uninstall the package:
brew uninstall <package>

Use this command to uninstall the specified software package, <package>replace with the name of the software package to be uninstalled.

  1. Update Homebrew:
brew update

This command is used to update Homebrew itself and package manifests.

  1. Update installed packages:
brew upgrade

Use this command to update all installed packages to the latest versions.

  1. Search for packages:
brew search <keyword>

Use this command to search for <keyword>packages related to .

  1. Show installed packages:
brew list

Use this command to list all installed packages.

  1. Display information for a specific package:
brew info <package>

This command will display detailed information about the specified package, including version numbers, dependencies, etc.

  1. Show dependencies of a package:
brew deps <package>

Use this command to view the dependencies of a specified package.

  1. Clean up outdated versions:
brew cleanup

This command is used to remove old versions of installed packages to free up disk space.

These are just some examples of commonly used Homebrew commands. Homebrew has many more commands and options. You can use the brew helpcommand to view the complete help documentation for more details and usage.

Guess you like

Origin blog.csdn.net/weixin_45361998/article/details/131498970