Posts Using homebrew for macos
Post
Cancel

Using Homebrew for macOS

MacOS logo with a plus sign followed by homebrew logo

Intro

MacOS is an operational system based on Unix kernel, and despite Apple provides an AppStore like some sort of package manager, it lacks a lot of important stuff, specially if you are an advanced user or a developer. With this in mind, community created the Homebrew or just brew project, which is a command line package manager that owns a organised and very extensive repository of packages and apps (casks), and is widely used by Mac users.

In this guide I’ll show how to install Homebrew and also some basic commands to install, remove and update packages and apps.

Requirements

Installing

With all requirements installed, brew installation is really easy. Brew is a ruby based project, so, just open your favorite terminal and execute the following command:

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

Usage

With Homebrew installed in your machine, open the terminal and start using brew. Use the quick reference below to manipulate packages:

Search for packages and casks

1
brew search ${package_or_cask_approximate_name}

List installed packages

1
brew list

Install package

1
brew install ${package_name}

Remove package

1
brew remove ${package_name}

Update package

1
brew upgrade ${package_name}

or to update all your packages (including homebrew itself)

1
brew upgrade

Obtaining installed package information

1
brew info ${package_name}

Homebrew also has an extension named cask. Its goal is to provide the same experience of brew core, but for the installation of Mac desktop apps. The usage is quite similar to the previous commands:

Install cask

1
brew install ${cask_name} --cask

List all installed casks

1
brew list --cask

Remove cask

1
brew remove ${cask_name} --cask

Update cask

1
brew upgrade ${cask_name} --cask

or to update all your casks

1
brew upgrade --cask

Obtaining installed cask information

1
brew info ${cask_name} --cask

Other thing that is worth a lot mentioning is the ability to manage daemons directly from brew, without using the native launchctl.

List executing services

1
brew services list

Execute service

1
brew services run ${service_name}

Stop service

1
brew services stop ${service_name}

Restart service

1
brew services restart ${service_name}

Conclusion

Homebrew eases the life of macOS users and specially those who are developers. As brew is a very mature and extensive software there may be other abilities not mentioned here in case you want to go deeper. Use the documentation for more information.

See you soon!

This post is licensed under CC BY 4.0 by the author.