0

I am trying to remove postgresql completely from my Mac M1 and then install postgres 13.

There were postgres 14, postgres 11 and postgres 13 installed (simultaneously) on my computer. Due to versions conflict I decided to remove all my postgreses and install version 13 de novo.

To uninstall postgres completely, I followed these recommendations: https://blog.testdouble.com/posts/2021-01-28-how-to-completely-uninstall-homebrew-postgres/

Now I have:

% postgres --version
zsh: command not found: postgres

% which postgresql
postgresql not found

% psql testdb
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory == NO DATABASES

%brew list also shows no postgres installed

but when I do

% psql --version

I see:

psql (PostgreSQL) 14.1

and

% which psql
/opt/homebrew/opt/libpq/bin/psql

So, I have front-end PostgreSQL 14 until now.

Is it normal that psql was not uninstalled with postgres server?

Of course some postgres files also remain in cache, as well as some Docker postgres images.

Should I remove postgresql14.1 client manually? Here I read that in such case after re-installation I can expect Error.

Or, in general: am I missing something that will prevent my computer from correct installing and running Postgres 13 locally and outside of Docker?

Thank you so much in advance for clarification.

kokserek
  • 530
  • 8
  • 21

1 Answers1

1

Yes, Postgres client (psql) and PostgreSQL server are two separate software. Quite often you need psql in your workstation even if server is running somewhere else.

But if you don't need to connect any PostgreSQL server anymore from your workstation, you can remove psql. No harm done. And it is always easy to re-install if needed.

ex4
  • 2,289
  • 1
  • 14
  • 21
  • Thank you for quick response! I found also some psql files in another place(s), in particular, here: /opt/homebrew/Cellar/libpq/14.1, and I can find more with ```sudo find / -name "*postgres*" -o -name "*psql*"```. Should I find and delete all of them manually? I didn't find any instructions how to do it automatically. – kokserek Dec 02 '21 at 09:54
  • 1
    I am not a mac user, so hard to say. But in general I would let package manager do its job and not remove any files by hand. It is always possible that some other software depends on those files. By the way, here is a nice article how to remove packages installed by homebrew: https://osxdaily.com/2018/07/29/uninstall-packages-homebrew-mac/ – ex4 Dec 02 '21 at 10:05
  • Thank you! Following the resource you specified, now I have: ```%brew uninstall psql Error: No available formula with the name "psql".```, ```% brew remove psql Error: No available formula with the name "psql".``` , but ```% which psql /opt/homebrew/opt/libpq/bin/psql``` and ```% psql psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket?```. I don't understand what actually is going on(( – kokserek Dec 02 '21 at 23:58
  • And now I know that "Homebrew only really has the postgres formula, and doesn't have any specific formula that only installs the psql tool" https://stackoverflow.com/questions/44654216/correct-way-to-install-psql-without-full-postgres-on-macos, also there is no formula for psql in documentation. But to delete psql manually does not look like a correct way. – kokserek Dec 03 '21 at 00:56