Some Homebrew Command
About Homebrew
Let’s first understand what Homebrew is. Homebrew is a package manager on MacOS that can be used to install free and open-source software, such as MongoDB, tree, and so on.
Install Homebrew
First, we need to install the XCode command line tools. It is a small independent package that provides many common tools for Mac users.
xcode-select --install
Download the installation script to your computer.
curl -fsSL -o install.sh https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
Check the installation script.
less install.sh
Execute the script.
/bin/bash install.sh
Some commonly used Homebrew commands
- Install the package.
brew install [package name]
- Use the which command to verify that the package is installed.
which [package name]
- Check the version of the installed package.
[package name] --version
- Update existing packages.
brew upgrade [package name]
- Uninstall packages no longer use.
brew uninstall [package name]
- View the versions of all installed packages.
brew list --versions
- See which services are running, which services are stopped, and their startup types.
brew services list
- Start a service.
brew services start [package name]
- Stop a service.
brew services stop [package name]
- Restart a service.
brew services restart [package name]
- Remove outdated downloads and older versions of installed packages from cache.
brew services cleanup
- Link an installed package.
brew link [package name]
For more brew commands, please check: https://docs.brew.sh/Manpage
Frequent Asked Questions
If you have any other questions, please check the Homebrew website: https://docs.brew.sh/FAQ#how-do-i-contribute-to-homebrew
Reference
[1] How To Install and Use Homebrew on macOS: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-homebrew-on-macos#step-1-using-the-macos-terminal
Subscribe to my newsletter
Read articles from Ziqing Ouyang directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by