I know there are a lot of lion-postgresql related questions on stack overflow already, but none seem to solve my problem.
I installed the homebrew of postgresql and everything was fine after that. Then I messed around a bit with the the libpq.dylib link in /usr/lib so that an application would link to the brew installed version rather than the OS-installed version. Somehow I managed to break my install while doing this in such a way that any call to psql gives the following error:
>psql
psql: invalid connection option "client_encoding"
reinstalling postgresql with 'brew remove postgresql' and another 'brew install postgresql' doesn't seem to help (same error). I've also relinked /usr/lib/libpq.dylib to be /usr/lib/libpq.5.dylib, which is what I believe it was before.
Also, a potentially related problem is that my postgres server doesn't seem to want to shut down:
>pg_ctl -D /usr/local/var/postgres stop -s -m fast
pg_ctl: server does not shut down
Anyone have any clues as to what is wrong? Alternatively, how would I completely uninstall and reinstall the postgres server and client?
Try /usr/local/bin/psql
. If that doesn't work, take a look at which psql
.
Lion comes with a installation of postgresql running, and you might be using the stock psql
instead of the brew psql
.
Or that one might be running, and using the brew psql to connect to the Lion postgres instance.
Verify that /usr/local/bin
is before /usr/bin
in $PATH
. Check echo $PATH
.
Fix that worked for me:
if you use pgAdmin:
show server_encoding;
-bash-4.1$ export PGCLIENTENCODING='UTF8' -bash-4.1$ psql
psql (9.3.3) Type "help" for help.
postgres=# \l ...
put var in .profile or .bashrc
If you installed postgresql via homebrew:
brew update
brew doctor
Unexpected dylibs: /usr/local/lib/libpq.5.dylib
Unexpected .la files: /usr/local/lib/psqlodbcw.la
brew upgrade postgresql
Error: The
brew link
step did not complete successfully
brew link --overwrite postgresql
Then you should be fine to run the psql
command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With