How to uninstall postgresql on my Mac (running Snow Leopard)
Upgraded 10.6 from 10.5 and now postgres 8.1 is whacked. To make things worse I tried installing 8.4 which I'm pretty sure just made things ten times worse. Anyhow开发者_如何学JAVA, the exception I'm getting when I try to fire postgres up and just createuser is this:
createuser: could not connect to database postgres: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
HOW do I fully get rid of postgres on my Mac so I can do a do-over?
Thanks
The problem was with the PostgreSQL account sitting on my machine.
I removed the account and proceeded with the uninstall using the instructions here:
Automatic Uninstall:
In the installation directory, there will be a uninstall-postgresql.app file. Executing (double clicking) that will uninstall the PostgreSQL installation.
Manual Uninstall:
Stop the server:
sudo /sbin/SystemStarter stop postgresql-8.3
Remove menu shortcuts:
sudo rm -rf /Applications/PostgreSQL 8.3
Remove the ini file:
sudo rm -rf /etc/postgres-reg.ini
Removing Startup Items:
sudo rm -rf /Library/StartupItems/postgresql-8.3
Remove the data and installed files:
sudo rm -rf /Library/PostgreSQL/8.3
Delete the user postgres:
sudo dscl . delete /users/postgres
I can add this tiny command to the answer too:
rm /usr/bin/psql
Remove executable psql alias.
If you have newer Postgres and/or OSX/macOS version, you can check this answer.
SINCE I couldn't run/find installbuilder.sh
using the following command...
me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ installbuilder.sh
-bash: installbuilder.sh: command not found
...I went on to try the steps below:
-
me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ls -la total 3112 drwxr-xr-x 5 root daemon 160 Sep 23 10:48 ./ drwxr-xr-x 5 root daemon 160 Sep 23 09:18 ../ -rwxr-xr-x 1 root daemon 673 Sep 23 10:48 installbuilder.sh* -rwxr-xr-x 1 root daemon 1449456 Sep 23 10:07 osx-x86_64* -rwxr-xr-x 1 root daemon 135216 Jul 14 11:21 uninstall-postgresql*
-
me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ./installbuilder.sh Unable to initialize installer
-
me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ./uninstall-postgresql Usage: ./uninstall-postgresql installerName [args ...]
-
me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ./uninstall-postgresql osx-x86_64
and VOILA!!!
This launched the uninstall GUI
Choose UNINSTALL ALL / REMOVE ENTIRE INSTALLATION
The uninstaller will do its thing and then prompt you with this:
At this point you'll want to follow the steps provided in this PREVIOUS StackOverflow ANSWER - steps 3 through 6 of @user1181328's answer. I'll list them here for convenience:
Remove the PostgreSQL and data folders. The Wizard will notify you that these were not removed.
sudo rm -rf /Library/PostgreSQL
Remove the ini file:
sudo rm /etc/postgres-reg.ini
Remove the PostgreSQL user:
- using System Preferences -> Users & Groups.
- Unlock the settings panel by clicking on the padlock and entering your password.
- Select the PostgreSQL user and click on the minus button.
Restore your shared memory settings:
sudo rm /etc/sysctl.conf
That should be all! The uninstall wizard would have removed all icons and start-up applications files so you don't have to worry about those.
精彩评论