Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to and Best of Homebrew


How To

Homebrew is a package management system for OS X. You can read more about it here, or simply run

ruby -e "$(curl -fsSL"

to install it.

First things first, you need to familiarize yourself with some of the basic homebrew commands.

All commands start with the binary brew.

brew search

If you are looking for something in particular, you can first search for it to see if homebrew has a formulae for what you're looking for. For example, running brew search tree will return

mvptree   pstree    tree      treecc    treeline
brew install

Once you find the formulae you're looking for, you can run brew install tree.

other important commands
  • brew list - List all installed formulae
  • brew update – Fetch the newest version of Homebrew and all formulae form GitHub using git.
  • brew upgrade [formulae] – Upgrade outdated formulae. This can take an optional argument if you only want to update one formulae
  • brew uninstall <formulae> – uninstall a specific formulae

There are a myriad of other commands and tasks you can run that we won't discuss in detail here. Running man brew or reading the documentation linked on Homebrew's main page.

Best Of

Now that you know how Homebrew functions, let's get into so of the best packages to install.

Right off the bat, brew is useful for things like git, vim, zsh, tmux, and many more base level tools that a lot of developers normally already have. We're going to look at some lesser known packages, but just know that Homebrew is getting larger, and almost anything that you would want that runs in the terminal is available as a homebrew package. If it isn't, it's incredibly easy to make it yourself. More on this later.

brew install hub

This is easily one of my favorites. You can think of hub as all the same functionality of git, but with add-ons that make it compatible with GitHub.

When you're deep in the codebase and realize that you haven't commited any of your hard work to GitHub, it's annoying to have to jump over to your browser, surf to, create a new repo, etc. That context switch just pulled you away from your important work and forced you to interact with – gulp – a GUI interface. How unfitting.

This is where hub comes into play. Important tasks that you were once only able to do through GitHub are now available via the terminal. Want to create a new remote repo and automatically set GitHub as the origin? hub create. Want to open a pull request? hub pull-request. Want to view your remote repo on GitHub from any sub-directory? hub browse. Of course this is not an exhaustive list of commands for hub.

Use hub --help or man hub for more information, customizing flags, and other goodies.

brew install the_silver_searcher

A quick and dirty way to search through any file structure for a key word or phrase.

You're in your Rails app and need to find all instances of current_user? ag current_user. ag is used for two reasons: 1) it would be awful to type the_silver_seracher before everything you want to search, 2) AG is the symbol for the chemical element silver. A common flag includes running the search with --context, which will print out the lines before and after the key phrase.

Some of you may be thinking, yeah, but I already have grep (or ack) which serves the same purpose. Try benchmarking ag vs. grep, you will find that ag is insurmountable when it comes to performance; grep may not even be able to run a search if the scope is too large.

Use ag --help or man ag for more information.

brew install tree

Lists the contents of directories in a tree-like format.

This one you kind of just have to try for yourself. It's not as crazy of a tool as some of the others, but if you want to see all files within a certain set of directories, tree does a great job of parsing it into a beautiful, readable format.

More info with tree --help or man tree (I'm going to stop referencing these "more infos" now since they are the same for nearly all packages).

brew install cask

Provides a friendly homebrew-style CLI workflow for the administration of Mac applications distributed as binaries.

Okay, this might be the coolest one I have found. This extends brew past the scope of the terminal and into your GUI applications. For example, you want to install Spotify. Instead of going to your browser to, clicking "Download Spotify", opening the zipped pacakge, etc., all you have to run is cask install spotify, and boom, it will be downloaded to your computer without any hassle. Not only is this amazing because it takes away having to search for all the apps you want, but it also keeps those apps in one location (opt/homebrew-cask/Caskroom/), making it easier to update, remove, and be aware of what you have installed on your machine.

Obviously this list is just a start, and I am constantly finding new and amazing packages to increase my productivity, but this gives a glimpse as just how amazing and powerful Homebrew is, and why it should be part of every developer's arsenal of tools.

Keep It Clean

With all this awesomeness, it's easy to forget that these tools need to be polished and take care of to perform correctly. I'll make it easy for you with a few aliases I created:

alias brewup='brew update; brew upgrade; brew prune; brew cleanup; brew doctor'

brewup will make it easy to keep homebrew neat. The first two commands I explained earlier. The third command, brew prune, will remove dead symlinks from the Homebrew prefix. This may sound confusing, and generally isn't needed, but it's never a bad idea to run. brew cleanup will remove any older versions of packages that you have, keeping things up to date. And last, brew doctor will check your system for potential problems. If no problems exist, you should see Your system is ready to brew after the doctor command runs.

Brew It Yourself

Homebrew formulae are simple Ruby scripts. Homebrew's GitHub page is very well documented on how to contribute your own formulae in the rare case that you can't find what you're looking for. Read more on this here

Thanks for reading my quick post. If you have any questions, see any errors, would like to learn about more productivity tools, or just want to chat, email me at or tweet @indiesquidge


This comment has been minimized.

Copy link

jamieoo commented Mar 11, 2017

Awesome write up. I had never heard of cask before. Thanks!


This comment has been minimized.

Copy link

jessicavrooyen commented Mar 16, 2017

Thanks this is great! Just FYI: The Homebew's GitHub page link gives 404.


This comment has been minimized.

Copy link

SAMFYB commented Sep 17, 2017

Really awesome!


This comment has been minimized.

Copy link

VaiBhardwaj commented Oct 11, 2017

How to remove brew completely?


This comment has been minimized.

Copy link

warmpiyro commented Nov 16, 2017

Real nice article. I thought you might want to fix the little typing error the_silver_searcher vs the_silver_seracher.


This comment has been minimized.

Copy link

mebeling commented Nov 22, 2017

The 404 error is because homebrew was split into two projects. This is an updated link to the page in the homebrew-core project.


This comment has been minimized.

Copy link

ethanbreck commented Dec 11, 2017

To remove brew completely, go to @warmpiyro.


This comment has been minimized.

Copy link

pYT0NN commented Mar 15, 2018

Thank you a lot, this really helped me get going !


This comment has been minimized.

Copy link

moshiuramit commented Mar 30, 2018

Pretty Helpful. Thanks for sharing.


This comment has been minimized.

Copy link

starobinskii commented Aug 6, 2018

Very nice! brewup and cask are really useful, also I'm interested to test ag now...


This comment has been minimized.

Copy link

iknowzo commented Aug 18, 2018

Awesome post! Thanks for sharing man!


This comment has been minimized.

Copy link

lhazlewood commented Aug 24, 2018

What's the difference between cask and mas ?


This comment has been minimized.

Copy link

markedphillips commented Sep 24, 2018

Nice, thanks.


This comment has been minimized.

Copy link

testacode commented Oct 31, 2018



This comment has been minimized.

Copy link

sheehan-agbayani commented Jan 25, 2019

brew prune is deprecated, so you can remove it from your alias.

Otherwise, thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.