-
Notifications
You must be signed in to change notification settings - Fork 5
Tips N' Tricks
- If you need something out of the path quickly just do `brew unlink foo’. This can be useful if some package can’t build against the version of some package you have linked into /usr/local, or other such conflicts.
- You can install stuff into Homebrew without a formula:
./configure --prefix=/usr/local/Cellar/foo/1.2 && make && make install && brew link foo
To enable tab-completion for brew commands and formulas, add the following to your ~/.bashrc:
source `brew --prefix`/Library/Contributions/brew_bash_completion.sh
Sometimes it’s faster to download a file via means other than those strategies that are available as part of Homebrew. For example, Erlang provides a Torrent that’ll let you download at 4x or 5x the normal HTTP method. Download the file and drop it in ~/Library/Caches/Homebrew
, but watch the file name. Homebrew downloads files as {{ formula name }}-{{ version }}
. In the case of Erlang, this requires renaming the file from otp_src_R13B03
to erlang-R13B03
.
New: mv the_tarball `brew --cache formula-name`
You can also pre-cache the download by using the external command brew fetch formula
which also displays the MD5. This can be useful for updating formulae to new versions.
Behind the scenes, Homebrew uses several commands for downloading files (e.g. curl, git, svn). Many of these tools can download via a proxy. It’s a common (though not universal) convention for these command-line tools to observe getting the proxy parameters from environment variables (e.g. http_proxy). Unfortunately, most tools are inconsistent in their use of these environment parameters (e.g. curl supports http_proxy, HTTPS_PROXY, FTP_PROXY, GOPHER_PROXY, ALL_PROXY, NO_PROXY).
Luckily, for the majority of cases setting http_proxy is enough. You can set this environment variable in several ways (search on the internet for details), but the way I prefer is:
$ http_proxy=http://<proxyhost>:<proxyport> brew install foo
If your proxy requires authentication, then you can do that like:
$ http_proxy=http://<user>:<password>@<proxyhost>:<proxyport> brew install foo
NB: this technique will also work if you prefer to use sudo with Homebrew. But as sudo clears the environment before it executes Homebrew, your proxy settings could get lost. You can work around this issue using:
$ http_proxy=http://<proxyhost>:<proxyport> sudo -E brew install foo