[Homebrew (brew) Cheatsheet] Homebrew (brew) Basics Commands
Homebrew - The Missing Package Manager for macOS (or Linux)
Homebrew is an essential piece of software to help you organize the tools you use. The package manager allows you to install a large number of software like NodeJS
or new versions of Git and will help you to keep them up to date.
These Homebrew commands will help you installing and maintaining the set of tools you need to develop good software.
Installation
1 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
Commands
brew install
Homebrew will give you a convenient way to install a package as simple as running the following in your terminal:
1 | brew install <package> |
brew upgrade, update outdated
You want to update a specific package? Run the following command:
1 | brew upgrade <package> |
If there is a package that you want to exclude from further updates, you can pin the package’s version like this:
1 | brew pin <package> |
In order to update Homebrew itself, run brew update
.
1 | brew update |
Simply run the following command to check all packages at once:
1 | brew outdated |
brew cask
Homebrew Cask provides a friendly CLI workflow for the administration of macOS applications distributed as binaries.
1 | Tap the Cask repository from Github. |
brew search, info
To check if there is a specific package, you can run:
1 | brew search <term> |
Homebrew will list all matching packages that you can install with brew install <package>
as mentioned above.
Before installing a package, you can also lookup some information about it by running:
1 | brew info <package> |
This will give you a description and further dependencies and requirements.
brew service
1 | brew services list |
brew cleanup
Clean up old versions of all packages.
1 | brew cleanup |
Clean up the old version of the specified package.
1 | brew cleanup <package> |
Remove old symlinks.
1 | brew prune |
Uninstall everything.
1 | brew remove --force --ignore-dependencies $(brew list) |
brew uninstall
To remove our package, we can run the uninstall task:
1 | brew uninstall <package> |
View the old version package that can be cleaned up without performing actual operations.
1 | brew cleanup -n |
brew tab
It is possible to add additional repositories to homebrew by making use of the brew tap command. This allows you to install additional applications that does not form part of the default set of repositories.
1 | List all the current tapped repositories (taps) |
brew analytics
If you don’t mind the collection of metrics then you do not have to do anything. If you do not want to be anonymously tracked then simply turn off the analytics:
1 | brew analytics |
brew doctor
Try brew doctor
first! It will give you a bunch of useful hints like:
1 | brew doctor |
Uninstall Homebrew
1 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" |
References
[1] The Missing Package Manager for macOS (or Linux) — Homebrew - https://brew.sh/