other

Brew basic commands

Using homebrew you can install and manage packages of different services and modules. You can start and stop a service directly from brew and use the service efficiently.

brew install package_name
brew services list //To List all services installed via brew
brew services start service_name //To start a service
brew services stop service_name //To stop a service

Here, we are listing useful commands that can be used to manage packages and services. For example, you can install git, MySQL services directly using brew commands and then start or stop them using brew command.

brew list
The above command will list down all the packages installed via brew on your system.
brew services list
This command will list all services started using brew.
brew install package_name
To install a package using homebrew we can use the above command. You need to add the package name after brew install command to install a new package
brew uninstall package_name
Like installation command, you can use uninstall in place of install to completely remove a package from homebrew.
brew upgrade package_name
To upgrade a package to its latest version in Homebrew, you can use above command. I will upgrade the package.
-- To unlink a package
brew unlink package_name

-- To link a package
brew link package_name
To unlink a package you can run command brew unlink package_name. This will not remove the package from your system but if you want to use the package, you will need to link them using brew link package_name commad.
brew switch package_name 2.1.5
If you are using multiple versions of a package in Homebrew, you can switch to specific version using above command.
brew list --versions package_name
To check the versions of a package installed via Homebrew, you can use the command brew list --versions package_name. It will print the version in the terminal window.
brew cleanup package_name
If you want to remove the old versions of a package, you can use the above command in the terminal with brew installed.
brew home package_name
To open the homepage of a package in the browser, you can use the brew home command.
For example, if you want to open the homepage of MySQL package installed via homebrew, you can use the command - brew home mysql.
brew update
To update the Homebrew version on your local system you can use the above command. The command will install components and modules that are required to update the Homebrew version.
brew upgrade
The command can be used to upgrade all the packages and modules installed via Homebrew.

brew outdated
The command will show the list of Homebrew packages that are not updated to its latest version.
brew doctor
If you are facing any error in Homebrew or its packages then you can run the above command. It will find the issues and show you the list of issues in the terminal.
Was this helpful?