27

After deleting Macports, I've had some strange behaviour. When I try to run PostgreSQL via CLI, I get:

pawel:~ pawel$ psql
dyld: Library not loaded: /opt/local/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/bin/psql
  Reason: image not found
Trace/BPT trap

This is strange because I've installed Postgresql through Homebrew and running brew list confirms that it's there. How would I get psql to work again?

Additionally, trying to install the pg gem fails due to an file not found: /opt/local/lib/libssl.1.0.0.dylib error. I need to make Postgres not look in the /opt/local/ directory for this file.

3 Answers 3

39

The solution is to uninstall postgresql then install it again. The reason it wasn't working was that the Macports install messed with some of the configs.

brew reinstall postgresql

4
  • 1
    Thank you, I was going insane because the install would never work. I didn't realize I just needed to uninstall and retry. May 23, 2018 at 2:06
  • 2
    brew reinstall mysql worked in case of mysql for me Jan 20, 2020 at 10:25
  • 2
    Just wanted to add that in 2020 this solved a similar problem after brew openssl was updated to 1.1.1. I was going a bit mad reinstalling ruby and the pg gem, but it turns out that postgress itself must have been compiled to look for openssl in the "old" location.
    – pixelearth
    Feb 10, 2020 at 10:06
  • Note that this might 're-install' a new (and incompatible) version of PostgreSQL! Feb 14, 2020 at 19:52
0

In case of Mac, in the ~/.bash_profile where you are updating the openssl path. Escape the openssl@1.1 as openssl\@1.1.

export PATH="/usr/local/opt/openssl\@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl\@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl\@1.1/include"
0

For me, just installing appropriate version of openssl worked.

brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

Reference: https://github.com/kelaberetiv/TagUI/issues/86

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.