![Must know brew commands Must know brew commands](https://code2care.org/pages/must-know-homebrew-commands-for-mac-linux-users-brew/images/Must know brew commands.jpg)
If you are a Mac or a Linux user then homebrew (or simply called brew) is the most popular package manager that you will use on a day-to-day basis for installing tools and software that you will need for software development.
In this article I have tried to cover a list of commands that you should be aware of to make the best out of the brew.
1. --version Command
% brew --version
% brew -v
% brew --version
% brew -v
You can use either --version or -v to print out the version number of homebrew as well as homebrew-core and cask on the console.
Example Output:Homebrew 3.5.10
Homebrew/homebrew-core (git revision eb53464deb8; last commit 2022-09-04)
Homebrew/homebrew-cask (git revision 40c8fdd23d; last commit 2022-09-04)
2. Brew Update Command
% brew update
% brew update
This command should be used to update your installed brew version to the latest version from GitHub as well as to keep your formulae list up to date.
You may use the update command with a few useful options,
- -f, --force
- -q, --quiet
- -v, --verbose
- -d, --debug
3. Brew Doctor Command
% brew doctor
% brew dr
% brew doctor
% brew dr
The doctor command is quite a useful one to know of any potential problems.
Example:% brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: You are using macOS 13.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
pre-release version.
Warning: Ruby version 2.6.10 is unsupported on macOS 13. Homebrew
is developed and tested on Ruby 2.6.9, and may not work correctly
on other Rubies. Patches are accepted as long as they don't cause breakage
on supported Rubies.
Warning: /usr/bin occurs before /opt/homebrew/bin in your PATH.
This means that system-provided programs will be used instead of those
provided by Homebrew. Consider setting your PATH so that
/opt/homebrew/bin occurs before /usr/bin. Here is a one-liner:
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
The following tools exist at both paths:
python3
pip3
4. Brew Help Command
The help command is the one that can help you quickly learn and understand brew commands and options.
% brew help
Example usage:
brew search TEXT|/REGEX/
brew info [FORMULA|CASK...]
brew install FORMULA|CASK...
brew update
brew upgrade [FORMULA|CASK...]
brew uninstall FORMULA|CASK...
brew list [FORMULA|CASK...]
Troubleshooting:
brew config
brew doctor
brew install --verbose --debug FORMULA|CASK
Contributing:
brew create URL [--no-fetch]
brew edit [FORMULA|CASK...]
Further help:
brew commands
brew help [COMMAND]
man brew
https://docs.brew.s
Example:
% brew help --version
Usage: brew --version, -v
Print the version numbers of Homebrew, Homebrew/homebrew-core and
Homebrew/homebrew-cask (if tapped) to standard output.
5. Search for formula
% brew search &l;formula-name>
6. List all Installed Formulae
% brew list
7. Install a formula
% brew install &l;formula-name>
8. Uninstall a formula
% brew uninstall &l;formula-name>
9. Find Outdated Formulae Command
10. Update Formulae Command
% brew upgrade <formula>
% brew search &l;formula-name>
% brew list
7. Install a formula
% brew install &l;formula-name>
8. Uninstall a formula
% brew uninstall &l;formula-name>
9. Find Outdated Formulae Command
10. Update Formulae Command
% brew upgrade <formula>
% brew install &l;formula-name>
% brew uninstall &l;formula-name>
9. Find Outdated Formulae Command
10. Update Formulae Command
% brew upgrade <formula>
% brew upgrade <formula>
This command will upgrade outdated casks and formulae
% brew outdated
This command will list out outdated casks and formulae.
11. Pin and Unpin Formulae Command
% brew pin <formula>
% brew unpin <formula>
% brew pin <formula>
% brew unpin <formula>
Pin to prevent the formula from being upgraded.
12. Get Information about a formula
% brew info <formula-name>
13. Cleanup
% brew cleanup --dry-run
% brew info <formula-name>
% brew cleanup --dry-run
The cleanup command with dry-run option will show what all outdated formulas will be cleaned up if you run the cleanup command if you do not want to clean a specific formula then you can pin it.
Example:% brew cleanup --dry-run
Would remove (empty directory): /opt/homebrew/etc/openssl@1.1/private
Would remove (empty directory): /opt/homebrew/etc/openssl@1.1/certs
% brew cleanup
Pruned 0 symbolic links and 2 directories from /opt/homebrew
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- Fix: grunt: command not found (Mac/Windows)
- AppleScript Example with TextEdit
- How to copy Password of Wifi on your Mac
- Install OpenJDK Java (8/11/17) versions using brew on Mac (Intel/M1/M2)
- How to check if a port is in use using terminal [Linux or macOS]
- Cut, Copy and Paste Keyboard Shortcuts on Mac Keyboard
- [macOS] NetBeans IDE cannot be installed. Java (JRE) found on your computer but JDK XX or newer is required.
- How to Remove Widgets from macOS Sonoma 14 Desktop
- Turn off Auto-Capitalization on macOS Ventura 13
- How to Go To /usr/local/bin on Mac Terminal?
- How to Open TextEdit on Mac
- Mac: How to Open Android Studio from Terminal
- How to change the default location of Mac Screenshot
- Display Seconds in Digital Clock on Mac Menu Bar [macOS]
- How to install homebrew (brew) on M1 Mac
- Must Know Homebrew Commands for Mac/Linux Users
- Steps to Uninstall Roblox on Mac (macOS)
- How to change the System Settings Sidebar icon size Mac Ventura 13
- How to set Out Of Office (OOO) on Outlook for Mac [Updated 2023]
- Trigger Notification Center Message using Mac Terminal Command
- [fix] macOS Ventura - Python3 xcrun: error: invalid active developer path missing xcrun at CommandLineTools
- How to Install Rust Language on Mac (macOS)
- How to minimize all Windows in Mac
- Display ls command file sizes in KB (kilobytes) MB (megabytes) or GB (gigabytes) [Linux/macOS]
- How to make TextEdit the default text Editor on Mac
- How to Download Apple Vision Pro visionOS Simulator on Xcode 15 - Apple
- Java location in Mac OS X - Mac-OS-X
- Python: How to POST Json Data with HTTP Request - Python
- How to Uninstall Brew on Mac - MacOS
- Notepad++ Replace space with Dot - NotepadPlusPlus
- Enable spell check in Sublime Text (macOS) - MacOS
- Java Jackson with Maven Example - Java
- Check CPU Usage using Mac Terminal Command - MacOS