JavaEar 专注于收集分享传播有价值的技术资料

Brew error: Could not symlink, path is not writable

When I try to install a library with homebrew (brew install aLibrary), I got the following error:

Could not symlink lib/pkgconfig/aFile
/usr/local/lib/pkgconfig is not writable.

What should I do?

There are several questions and answers (1,2,etc.) concerning this brew error, this is an attempt to make a general question as suggested here.


  1. As explained here by Rick:

    Start with brew doctor which will show you errors with your brew setup.

    You might see something like this: "Warning: /usr/local/lib/pkgconfig isn't writable."

    It will give you the advice that: "You should probably chown /usr/local/lib/pkgconfig".

    This means: sudo chown -R $(whoami) /usr/local/lib/pkgconfig

    Then you will need to link the files with this: brew link yourLibrary

    If this does not work hopefully the output of brew doctor will give you enough to continue the search.

  2. 参考答案2
  3. Use the following.

    $ brew doctor

    message will display error links to prune. If any found, run next option.

    $ brew prune

    once these are removed, proceed to link them agian

    $ brew link python
  4. 参考答案3
  5. I uninstalled brew, re-installed, then the issues went away.