psql Library not loaded: /usr/local/lib/libpq.5.dylib
brew doctor output
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: Some installed casks are deprecated or disabled.
You should find replacements for the following casks:
ksdiff
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Settings.
If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 15.1.
Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
[email protected]
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
➜ ~
Verification
- [X] My "
brew doctoroutput" above saysYour system is ready to brew.and am still able to reproduce my issue. - [X] I ran
brew updatetwice and am still able to reproduce my issue. - [X] This issue's title and/or description do not reference a single formula e.g.
brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.
brew config output
HOMEBREW_VERSION: 4.2.20
ORIGIN: https://github.com/Homebrew/brew
HEAD: c2ed3327c605c3e738359c9807b8f4cd6fec09eb
Last commit: 2 days ago
Core tap JSON: 30 Apr 17:13 UTC
Core cask tap JSON: 30 Apr 17:13 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 14.0.3 build 1403
Git: 2.44.0 => /opt/homebrew/bin/git
Curl: 8.1.2 => /usr/bin/curl
macOS: 13.5.1-arm64
CLT: 14.3.1.0.1.1683849156
Xcode: N/A
Rosetta 2: false
What were you trying to do (and why)?
I install postgres 16 and run it. When I try the command psql, I got this error
What happened (include all command output)?
dyld[28821]: Library not loaded: /usr/local/lib/libpq.5.dylib Referenced from: <4A4C9EBE-1868-317F-A86C-2DAE62CA9064> /usr/local/bin/psql Reason: tried: '/usr/local/lib/libpq.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libpq.5.dylib' (no such file), '/usr/local/lib/libpq.5.dylib' (no such file), '/usr/lib/libpq.5.dylib' (no such file, not in dyld cache) [1] 28821 abort psql
What did you expect to happen?
postgres database should run
Step-by-step reproduction instructions (by running brew commands)
brew install postgresql@16
brew services start postgresql@16
brew services list
psql
What's the output of psql --version? I'm guessing it's not 16.x, since postgresql@16 is keg-only.
Also check the output of ls -l /usr/local/bin/psql.
That's not Homebrew's psql, and I should've noticed earlier that you're running on an ARM64 Mac, for which Homebrew installs exclusively under /opt/homebrew.
You're looking for /opt/homebrew/opt/postgresql@16/bin/psql instead.
Yeah, that's the psql you want to run.
How can I run that one ?
Just like that: /opt/homebrew/opt/postgresql@16/bin/psql.
Now I got database not found, how can I create/edit database if I can't run postgres ?
You're asking us how to use PostgreSQL at this point which is not an issue with Homebrew.
I solved this
I just do this rm -rf /usr/local/bin/psql
And remove all postgres that were installed by homebrew
Then install postgres app from https://postgresapp.com/downloads.html
Now my psql commpand works