Homebrew Cheatsheet

798




Installation for MacOS

Prerequisities

Install command-line tools if not already installed by running the following command

xcode-select --install

Note: If you have installed Xcode already then your mac already have command-line tools.

Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Installing a software

You can install brew available softwares by running the following command

brew install <software_name>

example

brew install mongodb

If you want to install a specific version of a sooftware, you can mention the available version name using @<version>

Example

brew install [email protected]

Uninstalling a softwware

You can uninstall a installed software by running the following command

brew remove <software_name>

example

brew remove mongodb

Searching for a software

You can search available softwares by running following command

brew search <software_name>

Example

$ brew search mongodb
==> Formulae
mongodb ✔                                [email protected]                              [email protected]
[email protected]                              [email protected]                              percona-server-mongodb

==> Casks
mongodb                                  mongodb-compass-community                mongodbpreferencepane
mongodb-compass                          mongodb-compass-isolated-edition         nosqlbooster-for-mongodb
mongodb-compass-beta                     mongodb-compass-readonly                 orelord-mongodb

Other useful commands

CommandUseExample
brew doctorself-diagnose shows if the installatin is correct or notNA
brew upgrade <software_name>To Update a installed sooftwarebrew upgrade mongodb

Uninstalling Homebrew

In case you decided to completely uninstall Homebrew from your Mac, you can run the followiong command to uninstall

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"