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`
Asked
Active
Viewed 4.4k times
24
4 Answers
24
- brew reinstall pkg-config
- rm -R offending-directory
- repeat step 1

dpott197
- 1,060
- 1
- 9
- 11
-
1is there a similar solution to this but for ubuntu? – Charlie Parker Aug 20 '14 at 21:25
-
third step is useless or should be `brew unlink pkg-config && brew link pkg-config` – soyuka May 08 '15 at 21:52
-
1You can merge the first three steps with `brew reinstall pkg-config`. – bfontaine Oct 19 '15 at 11:45
9
As Michael Pigg said above, in my case it was the folder permission issue. I had to do the following:
sudo chmod 777 /usr/local/bin
sudo chmod 777 /usr/local/share/man/man1
brew link pkg-config
And after I'm done:
sudo chmod 755 /usr/local/bin
sudo chmod 755 /usr/local/share/man/man1
to restore the original permissions.

kakyo
- 10,460
- 14
- 76
- 140
2
It may be a permissions issue on /usr/local/share. You need to have write permission in that directory for the link to complete. However, zsh will complain about the directory being insecure if you set the write permission. I gave the write permission to allow pkg-config to install and then removed it so that zsh would be happy.

Michael Pigg
- 596
- 3
- 5
1
- reinstall command line tools: https://developer.apple.com/downloads/index.action
- brew link --overwrite --dry-run pkg-config

Kuner
- 11
- 1