DEV Community

loading...
Cover image for Homebrew: Beginner's guide to installation and usage. Mac OS X

Homebrew: Beginner's guide to installation and usage. Mac OS X

shimphillip profile image Phillip Shim Originally published at shimphillip.netlify.com ・3 min read

 

Homebrew is brewed for your success. It definitely should be one of the software you should install on your machine as soon as you get your new shiny brand-new computer. Although it's not too late if you have been using it for a while (wink).

According to the official website of Homebrew, it declares 'Homebrew is the missing package manager for OS X and Linux and it installs the stuff you need that Apple (or your Linux system) didn’t.' If you have ever used NPM(Node Package Manager) before, it works in a similar way.

Without you going through hassles of individually downloading installer files, execute them and move them to the application folder. Within the terminal, you can easily issue simple commands to automate downloading and installing software, view the packages that your computer has and maintain them easily.

Without further ado, let's get this started.

 

Installation Steps

  • First, open up your terminal by hitting (⌘ + space), then start typing in the word 'terminal'. Hit enter to open up the terminal.

  • You need to download and install xcode-select: A command-line utility program required to install Homebrew. Follow the command prompt!

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

Homebrew gets installed globally and can run from anywhere. Verify Homebrew is correctly installed by running

brew

Which will output a short info page.

 

Important terms

Formula: A simple ruby script that runs a CLI program meaning any software that runs inside the terminal.

Cask: An extension to brew that allows management of graphical applications through the Cask project. It covers pretty much all desktop apps with exception to CLI apps.

Practical commands

Search

brew search [TEXT|/REGEX/]

Searches for brew formulae. Typing simply brew search lists all the available formulae that's ever published via Homebrew. Passing in an argument as a string or a regex will search a corresponding formula or a cask. If it can't find a perfect match, it will perform an inclusive search and return any results that contain the argument you passed. E.g. Running brew search zs ->

Alt Text

Install

brew install Formula... // homebrew, node, speedtest-cli
brew cask install Cask... // firefox, visual-studio-code, discord

Simple as it sounds! It will install a formula or a cask. What are some useful formulas you can download? A good one is 'speedtest-cli'. The most popular speed test web app out there is https://www.speedtest.net/ by Ookla which displays a few annoying ads. You can bypass all these and simply install a CLI version of the app.

brew install speedtest-cli
speedtest-cli // shows download/upload speed of your connection

Uninstall

brew uninstall Formula...
brew cask uninstall Formula...

Uninstalls installed formulae or Casks.

List

brew list [Formula...]
brew cask list [Cask...]

Without arguments, list installed formulae or Casks.
With arguments, show where the matched apps are installed in the filesystem.

Update/Upgrade

brew update // updates Homebrew
brew upgrade [Formula...] // updates installed Formulae and Casks

Troubleshooting

brew doctor

Scans through installed formulae and Casks to apply any fixes.

After all, Homebrew is so awesome that it makes really convenient for users to download and install pretty much any applications on the terminal. It also provides tools to easily manage the packages through updating, perform automatic troubleshooting and uninstalling. All hail to Homebrew!!

 

Discussion (0)

Forem Open with the Forem app