I'm running Homebrew 0.9.5 under OS X Mavericks. My ultimate goal is to compile the source code for a program (not available through Homebrew) which depends on pkg-config. After installing Homebrew I ran brew install pkg-config, got a "brew link error", and ran brew link --overwrite pkg-config. This gave me a different error: Error: Could not symlink share/doc/pkg-config/pkg-config-guide.html /usr/local/share/doc/pkg-config is not writable. I can't seem to get past this error. Running sudo chmod 666 /usr/local/share/doc/pkg-config does not change the file permissions from -rw-r--r--. Similarly I came across a similar question on this site where the issue was fixed by doing sudo chown -R $(whoami) /usr/local; but this didn't work either in my case. Why am I not able to add write permissions to this file?

More details

I originally thought it would be no big deal to compile pkg-config on my own, but when I tried doing so I found myself in a maze of dependencies: pkg-config requires (and is required by) glib, which requires gettext and libffi. When I tried to compile gettext I was able to run make and make install but got several errors and "...not found" messages in the process. Nonetheless it seemed to be installed correctly. Once I got gettext and libffi installed, I tried to do ./configure glib and got an error related to gettext. At that point I gave up and installed homebrew. After installation I got messages advising I remove some files, and did so. I also got this: Warning: Some directories in /usr/local/share/locale aren't writable. ... You should probablychownthem. I did that as well. Then I tried to install pkg-config and ran into the problem described above.


Maybe you installed pkg-config before. You may uninstall and reinstall it.

brew uninstall pkg-config


According to the error message the directory with permissions issue is /usr/local/share/doc/pkg-config, but you claim to have run sudo chown -R $(whoami) /usr/local which changes ownership of /usr/local directory only, not affecting any sub-directories. You should run

sudo chown -R $(whoami) /usr/local/share/doc/pkg-config

and see how that goes. If it doesn't help, please add the output of ls -l /usr/local/share/doc/pkg-config to your post to make it clear what's going on.

As a side note, it's perfectly normal for sub-directories of /usr to be owned by root and not be writable by regular users. Rather than changing the permissions / ownership, you should run commands writing in these directories as root, e.g.

sudo brew install pkg-config

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.