libpng Not Symlinking When Installing ImageMagick on OS X Yosemite


After upgrading from OS X Mavericks to OS X Yosemite, I attempted to install ImageMagick from Homebrew, but encountered an error when brew was trying to install the libpng dependency.

The error encountered was:

[20:32:21][user@workstation][~] brew install libpng
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libpng-1.6.14.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/libpng-1.6.14.yosemite.bottle.tar.gz
==> Pouring libpng-1.6.14.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man5/png.5
/usr/local/share/man/man5 is not writable.

You can try again using:
  brew link libpng
==> Summary
/usr/local/Cellar/libpng/1.6.14: 17 files, 1.2M

I tried several of the potential fixes in an older StackOverflow thread about OS X Lion trouble with ImageMagick, but nothing worked.

I finally tried Jonghee Park’s suggestion to correct permissions.

Sure enough, the permissions for the man5 folder in /usr/local/share/man were incorrect:

[20:34:12][user@workstation][index_page] ls -al /usr/local/share/man
total 8
drwxr-xr-x  19 user  admin   646 Nov 23 20:34 .
drwxr-xr-x  11 user  admin   374 Nov 23 20:29 ..
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 de
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 es
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 fr
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 hr
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 hu
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 it
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 ja
drwxr-xr-x  48 user  admin  1632 Nov 23 20:32 man1
drwxr-xr-x   3 root  wheel   102 Aug 31 00:00 man5
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 pl
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 pt_BR
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 pt_PT
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 ro
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 ru
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 sk
-rw-r--r--   1 root  admin  1544 Nov 21 00:55 whatis
drwxr-xr-x   3 user  admin   102 Oct 19 17:29 zh

The fix was as simple as running the following command:

sudo chown -R user:admin /usr/local/share/man/man5

And, re-running brew link libpng.

This problem did not occur with a fresh install of OS X Yosemite.

If you found this post useful, you can help support this site and get something for yourself by signing up for any of the services listed below through the provided links.

The following links are part of affiliate programs, and I will receive a referral payment from any of the services you sign-up for.

  • Get Faster Shipping: Perhaps you're about to order some stuff on Amazon but want to get more value out of the money you would normally pay for shipping. Sign-up for a free, 30-day trial of Amazon Prime to get free two-day shipping, access to thousands of movies and TV shows, and more.
  • Start Investing Now: Are you looking to start investing some of your disposable saved income? Get started by opening an account with Webull, where upon sign-up and opening a brokerage account with an initial deposit of at least $100 you will receive 1 stock valued (subject to change based on normal market movement) between $8 and $1600.

Thanks for reading and take care.