Homebrew 将二进制文件放在哪里?

Where does Homebrew put the binaries?

默认情况下,Homebrew 是否在 /usr/local/bin 中安装软件包,即将二进制文件放在那里?

我们可以告诉 Homebrew 将二进制文件放在其他地方吗?

二进制文件位于 /usr/local/bin

来自Homebrew FAQ

Why does Homebrew insist I install to /usr/local?

  1. It’s easier
    /usr/local/bin is already in your PATH.
  2. It’s easier
    Tons of build scripts break if their dependencies aren’t in either /usr or /usr/local. We fix this for Homebrew formulae (although we don’t always test for it), but you’ll find that many RubyGems and Python setup scripts break which is something outside our control.
  3. It’s safe
    Apple has left this directory for us. Which means there is no /usr/local directory by default, so there is no need to worry about messing up existing tools.

If you plan to install gems that depend on brews then save yourself a bunch of hassle and install to /usr/local!

It is not always straightforward to tell gem to look in non-standard directories for headers and libraries. If you choose /usr/local, many things will "just work".

可以更改位置(又名前缀),但不推荐这样做。来自 docs:

However do yourself a favor and install to /usr/local. Some things may not build when installed elsewhere. One of the reasons Homebrew just works relative to the competition is because we recommend installing to /usr/local. Pick another prefix at your peril!

mkdir homebrew && curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C homebrew

Create a Homebrew installation wherever you extract the tarball. Whichever brew command is called is where the packages will be installed.