After installing PhantomJS 2.5 Beta on MacOS, I ran into the following error after trying to get the version:
dyld: Library not loaded: /usr/local/opt/webp/lib/libwebp.6.dylib
After some research, I found out that the library behind it ‘webp’ had been updated to libwebp.7.dylib.
Step 1: Install webp via Homebrew
If you have a Mac and are a developer, I assume that you already have homebrew installed. If you don’t know what this means, you can checkout the homebrew site at: https://brew.sh
- Before starting, ensure your homebrew installation is up to date
brew update
- Install webp:
brew install webp
Step 2: Add a symlink for libwebp.6.dylib to reference libwebp.7.dylib
- Close and re-open, or open another terminal window
- Browse to your webp lib directory
cd /usr/local/opt/webp/lib
- Look at the directory for the library file
ls
- If you see libwebp.7.dylib, add the symlink
ln -s libwebp.7.dylib libwebp.6.dylib
- If you see a version different from libwebp.7.dylib, you can try the other version in place of libwebp.7.dylib in the example above
Step 3: Test it out
- Close all of your previous terminal windows and open up a new one
- Try checking the PhantomJS version again:
phantomjs --version
You just saved my day, thank you! Is there any reason why they don’t use libwebp.7.dylib in the first place?
You’re welcome! The library discrepancy is just a side effect of beta where releases are sporadic and off schedule. A good prod release would follow OS vendor releases and updates.
Rock on!