[macOS] dyld: Library not loaded: /usr/local/lib/QtWebKit.framework/Versions/4/QtWebKit
I’ll introduce the story of resolving the issue where wkhtmltopdf wouldn’t work with the dyld: Library not loaded: /usr/local/lib/QtWebKit.framework/Versions/4/QtWebKit error after upgrading from macOS Sierra to High Sierra.
 
$ /usr/local/bin/wkhtmltopdf --version
dyld: Library not loaded: /usr/local/lib/QtWebKit.framework/Versions/4/QtWebKit
  Referenced from: /usr/local/bin/wkhtmltopdf
  Reason: image not found
Since it said “Library not loaded,” I checked the relevant directory and found that only Versions 5 existed.
$ ls -l /usr/local/lib/QtWebKit.framework/Versions
total 0
drwxr-xr-x  5 username  admin   160B 10 13  2015 5
lrwxr-xr-x  1 username  admin     1B 10 13  2015 Current -> 5
Since wkhtmltopdf was installed with brew, I’ll reinstall it (uninstall && install).
brew uninstall wkhtmltopdf
brew install caskroom/cask/wkhtmltopdf
$ /usr/local/bin/wkhtmltopdf --version
wkhtmltopdf 0.12.5 (with patched qt)
That’s all from the Gemba where I encountered a dyld: Library not loaded error.