Tips and Tricks

Install previous versions of formulae

Some formulae in homebrew/core are made available as versioned formulae using a special naming format, e.g. gcc@7. If the version you’re looking for isn’t available, consider using brew extract.

Quickly remove something from Homebrew’s prefix

brew unlink <formula>

This can be useful if a package can’t build against the version of something you have linked into Homebrew’s prefix.

And of course, you can simply brew link <formula> again afterwards!

Pre-download a file for a formula

Sometimes it’s faster to download a file via means other than the strategies that are available as part of Homebrew. For example, Erlang provides a torrent that’ll let you download at 4–5× compared to the normal HTTP method.

Downloads are saved in the downloads subdirectory of Homebrew’s cache directory (as specified by brew --cache, e.g. ~/Library/Caches/Homebrew) and renamed as <url-hash>--<formula>-<version>. The command brew --cache -s <formula> will print the expected path of the cached download, so after downloading the file, you can run mv the_tarball "$(brew --cache -s <formula>)" to relocate it to the cache.

You can also pre-cache the download by using the command brew fetch <formula> which also displays the SHA-256 hash. This can be useful for updating formulae to new versions.

Install stuff without the Xcode CLT

brew sh          # or: eval "$(brew --env)"
gem install ronn # or c-programs

This imports the brew environment into your existing shell; gem will pick up the environment variables and be able to build. As a bonus, brew’s automatically determined optimization flags are set.

Install only a formula’s dependencies (not the formula)

brew install --only-dependencies <formula>

Use the interactive Homebrew shell

$ brew irb
==> Interactive Homebrew Shell
Example commands available with: `brew irb --examples`
irb(main):001:0> Formulary.factory("ace").methods - Object.methods
=> [:install, :test, :test_defined?, :sbin, :pkgshare, :elisp,
:frameworks, :kext_prefix, :any_version_installed?, :etc, :pkgetc,
:on_macos, :on_linux, :debug?, :quiet?, :verbose?, :with_context]

Hide the beer mug emoji when finishing a build


This sets the HOMEBREW_NO_EMOJI environment variable, causing Homebrew to hide all emoji.

The beer emoji can also be replaced with other character(s):


Editor plugins

Sublime Text




Fork me on GitHub