29

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, 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

2
  • How did you install Postgresql, via source or some package install method? Commented Apr 26, 2010 at 17:03
  • I don't remember how I originally installed it. Wasn't from source. I think it was the install from here: postgresqlformac.com Commented Apr 26, 2010 at 17:12

4 Answers 4

63

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:

  1. Stop the server:

    sudo /sbin/SystemStarter stop postgresql-8.3
    
  2. Remove menu shortcuts:

    sudo rm -rf /Applications/PostgreSQL 8.3
    
  3. Remove the ini file:

    sudo rm -rf /etc/postgres-reg.ini
    
  4. Removing Startup Items:

    sudo rm -rf /Library/StartupItems/postgresql-8.3
    
  5. Remove the data and installed files:

    sudo rm -rf /Library/PostgreSQL/8.3
    
  6. Delete the user postgres:

    sudo dscl . delete /users/postgres 
    
Sign up to request clarification or add additional context in comments.

Comments

9

I can add this tiny command to the answer too:

rm /usr/bin/psql

Remove executable psql alias.

6 Comments

This is closer to the answer than the above. Apple ships with postgres binaries preinstalled (as of Lion, 10.7). There will not be the uninstaller that the chosen answer mentions.
well the question clearly states that its not lion but snow-leopard (10.6), but nevermind, the chosen answer works perfectly.
explain what, the line and comment stands on its own. Its an extra line for the answer above or would you rather the entire answer was repeated?
You will also need to do get rid of all the /usr/bin/pg_* executables (like pg_dump, pg_restore, etc.)
I think better is to add postgres installation /bin path to the system $PATH instead of removing parts of system. After that you will use versions of psql pg_* same as postgresql server.
|
2

If you have newer Postgres and/or OSX/macOS version, you can check this answer.

Comments

0

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:

  1. 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*  
    
  2. me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ./installbuilder.sh
    Unable to initialize installer  
    
  3. me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ./uninstall-postgresql  
    Usage: ./uninstall-postgresql installerName [args ...]
    
  4. me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ./uninstall-postgresql osx-x86_64
    

and VOILA!!!

  1. This launched the uninstall GUI

  2. Choose UNINSTALL ALL / REMOVE ENTIRE INSTALLATION enter image description here

  3. The uninstaller will do its thing and then prompt you with this: enter image description here

  4. 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:

  1. Remove the PostgreSQL and data folders. The Wizard will notify you that these were not removed.
    sudo rm -rf /Library/PostgreSQL

  2. Remove the ini file:
    sudo rm /etc/postgres-reg.ini

  3. 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.
  4. 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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.