PG Gem fails on Mac OS 11.x (Big Sur)
If after installing pg gem in your ruby project and you get the following error with the pg gem
Library not loaded: libpq.5.dylib
You can fix the linking issues by running the following commands:
cd ~/[your ruby path]/versions/2.7.2/lib/ruby/gems/2.7.0/gems/pg-1.2.3/lib
install_name_tool -change libpq.5.dylib /Library/PostgreSQL/12/lib/libpq.5.12.dylib pg_ext.bundle
You may need to modify the commands above to suite your ruby manager and currently installed versions.
Tweet