$ brew install unrar
Warning: It appears you have Macports or Fink installed
Although, unlikely, this can break builds or cause obscure runtime issues.
If you experience problems try uninstalling these tools.
/usr/local/Library/Formula/unrar.rb:3: warning: already initialized constant ALL_CPP
==> Downloading http://www.rarlab.com/rar/unrarsrc-3.9.4.tar.gz
######################################################################## 100.0%
==> g++ -O4 -march=core2 -mmmx -msse3 -w -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE all.cpp -o unrar
/usr/local/Cellar/unrar/3.9.4: 3 files, 320K, built in 13 seconds
可以看到,unrar 被安装到了 /usr/local/Cellar/unrar/3.9.4 这个目录下,但这样我们访问起来显然很不方便,所以 Homebrew 会在 /usr/local/bin 下面创建到 unrar 程序的符号链接,如果安装的是库之类的,也会对应在 /usr/local/lib 这样的目录下创建符号链接。所以这是一套类似 GoboLinux 的软件管理方式。
安装后就可以用 list 命令列出:
$ brew list
pkg-config unrar
更新
如果用了一段时间,需要更新同步上游的 Formula,可以简单地:
$ brew update
From git://github.com/mxcl/homebrew
* branch master -> FETCH_HEAD
Updated Homebrew from 60600885 to 60600885.
No formulae were updated.
Homebrew 会通过 git 完成同步。