开发者

How to uninstall postgresql on my Mac (running Snow Leopard)

开发者 https://www.devze.com 2022-12-28 09:56 出处:网络
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

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:

  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 
    


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:

  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

    How to uninstall postgresql on my Mac (running Snow Leopard)

  3. The uninstaller will do its thing and then prompt you with this:

    How to uninstall postgresql on my Mac (running Snow Leopard)

  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.

0

精彩评论

暂无评论...
验证码 换一张
取 消