Reputation: 3880
Today I installed the curl
formula via homebrew
, but after installing it (and re-sourcing the shell) i noticed that :
% which curl
/usr/bin/curl
as a matter of fact, the output of brew install curl
stated that it was a keg-only formula, and that since curl
was already present in OS X, it didn't link it into Homebrew prefix, as that could cause unspecified problems.
Then it proceeds stating that
Generally there are no consequences of this for you
I would like to know:
PATH
?Upvotes: 57
Views: 25192
Reputation: 19
I want to add some complement to the second problem(related to the mechanism of keg-only) asked by @asymmetric.
HomeBrew's prefix is /usr/local
, and HomeBrew keeps all installed kegs in the default directory, say /usr/local/Cellar
. In general, HomeBrew could create symlink for installed formula(non-keg-only formula), and the corresponding symlink is kept in /usr/local/bin
. This symlink-creation procedure is automatic when HomeBrew installing the formula. Here the path /usr/local/bin
would be called default (symlink) prefix.
On the other hand, according to FAQ of HomeBrew, we have the following guidance:
``keg-only formula is installed only into the Cellar and is not linked into the default prefix. This means most tools will not find it.''
But at the same time the HomeBrew creates symlinks in the directory /usr/local/opt
for ALL installed formulae no matter whether they are keg-only or not.
There will be two crucial points we should notice:
/usr/local/bin
is in PATH
, but the non-prefix /usr/local/opt
is NOT in PATH
./usr/local/bin
in general points towards the latest version of formula. So if you want to use the specific version(often in keg-only format) of some formula you could temporarily prepend your PATH
with the keg-only formula's bin
directory, for example, export PATH="$(brew --prefix)/opt/FormulaName/bin:${PATH}"
.The setting of /usr/local/opt
mentioned above could resolve the executable-conflict. In general, you might have a formula or program in your system with many different versions, such as the latest version and outdated version, the Apple native version and locally installed version, an so on. It's possible for these situations to cause conflict when you execute or compile some other programs which are somewhat related to the current using formula or program.
Upvotes: 1
Reputation: 78105
Upvotes: 60