Benjamin Bouillé bio photo

Benjamin Bouillé

IT consultant

Email Twitter Google+ LinkedIn Github Stackoverflow

Trying to install pkg-config :

$  brew install pkg-config
[...]
Warning: Could not link pkg-config. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link pkg-config'
==> Summary
/usr/local/Cellar/pkg-config/0.28: 10 files, 636K

Go deeper :

$ brew link pkg-config
Linking /usr/local/Cellar/pkg-config/0.28... Warning: Could not link pkg-config. Unlinking...
Error: Could not symlink file: /usr/local/Cellar/pkg-config/0.28/share/doc/pkg-config
/usr/local/share/doc/pkg-config may already exist.
/usr/local/share/doc may not be writable.

The solution :

  1. brew uninstall pkg-config
  2. brew install pkg-config
  3. brew link pkg-config
  4. rm -rf <offending-directory>
  5. repeat step 1

source