Some formulae in `homebrew/core` are made available as [versioned formulae](Versions.md) using a special naming format, e.g. `gcc@9`. If the version you're looking for isn't available, consider using `brew extract`.
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 --build-from-source <formula>` will print the expected path of the cached download, so after downloading the file, you can run `mv the_tarball "$(brew --cache --build-from-source <formula>)"` to relocate it to the cache.
You can also pre-cache the download by using the command `brew fetch <formula>` which also displays its SHA-256 hash. This can be useful for updating formulae to new versions.
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.
Running `brew bundle dump` will record an installation to a `Brewfile` and `brew bundle install` will install from a `Brewfile`. See `brew bundle --help` for more details.
Use [`brew alias`](Manpage.md#alias---edit-aliasaliascommand) to define custom commands that run other commands in `brew` or your shell, similar to the `alias` shell builtin.
```shell
# Add aliases
$ brew alias ug='upgrade'
$ brew alias i='install'
# Print all aliases
$ brew alias
# Print one alias
$ brew alias i
# Use your aliases like any other command
$ brew i git
# Remove an alias
$ brew unalias i
# Aliases can include other aliases
$ brew alias show='info'
$ brew alias print='show'
$ brew print git # will run `brew info git`
```
Note that names of stock Homebrew commands can't be used as aliases.
All aliased commands are prefixed with `brew`, unless they start with `!` or `%`:
```shell
$ brew alias ug='upgrade'
# `brew ug` → `brew upgrade`
$ brew alias status='!git status'
# `brew status` → `git status`
```
You may need single quotes to prevent your shell from interpreting `!`, but `%` will work for both quote types.
```shell
# Use shell expansion to preserve a local variable
$ mygit=/path/to/my/git
$ brew alias git="%$mygit"
# `brew git status` → `/path/to/my/git status`
```
Aliases can be opened in `$EDITOR` with the `--edit` flag.
- [Brew Services](https://marketplace.visualstudio.com/items?itemName=beauallison.brew-services) is an extension for starting and stopping Homebrew services.
- [Homebrew-formula-syntax](https://github.com/samueljohn/Homebrew-formula-syntax) can be installed with Package Control in Sublime Text 2/3, which adds highlighting for inline patches.
- [homebrew-mode](https://github.com/dunn/homebrew-mode) provides syntax highlighting for inline patches as well as a number of helper functions for editing formula files.
In the macOS Terminal, you can right-click on a command name (like `ls` or `tar`) and pop open its manpage in a new window by selecting "Open man Page".
Terminal needs an extra hint on where to find manpages installed by Homebrew because it doesn't load normal dotfiles like `~/.bash_profile` or `~/.zshrc`.