HomeBrew is a convenient package manager for Mac user. For some reason I prefer Home Brew to Mac Ports.
Brew has a younger package repository since it has shorter history comparing to MacPorts. Younger repository means less options. And sometime it is hard for you to install the old-fashioned tool with brew.
Brew uses git to manage its formula repository, so you can list with git.
Typically, the repo is located at /usr/local
. But since this path can be changed, so it is safer to reference this path via brew.
Brew call the repo path as prefix, so you can reference the path with brew --prefix
You can use the following shell command to enter the brew repo.
|
|
Since brew load formula from local, so before we install the app with brew, we need to ensure the repo is updated. We can use the following command to update the brew repo:
|
|
To install specific version of the app, we need to checkout the specific version of the formula, we can get the versions and related git revision by brew versions
command, and checkout specific version, then install the app:
|
|
If we cannot find the specific version that we want (Such as Postgres 8.3.11). don’t be disappointed, we can try to search the version repository.
Some of the old-fashioned tool which is not included in brew’s master repo might be provided in version repository.
Begin from Brew 0.9 provide the multiple repository support, user can use brew tap
command to register alternative repositories besides the master repo. There are quite a some interesting alternative repos, such as versions and games.
These official alternative repos can be found on github
The formulas in alternative repositories cannot be used directly, but luckily the official ones are included in the search result.
|
|
In the search result, we can see there are 2 formulas are displayed with a path rather than just the formula name, which means these formulas are in a alternative repo.
The path to the formula follows the convention: <github username>/<repository name without "homebrew-">/<formula name>
.
So homebrew/versions/postgresql8
means the file is located at https://raw.github.com/Homebrew/homebrew-versions/master/postgresql8.rb
To install it, we can install it directly or tap the repo first:
|
|