Search code examples
postgresqlmacosuninstallationpostgresql-14

HowTo: Completely Uninstall Postgresql14 from MacOs Catalina If I've used the EnterpriseDB.com GUI installer


I've been trying to get this to work by following the answers in these questions:


...but they're not working. So, here's what I have tried instead/in addition...

.

me@myMac:~$ cd /Library/PostgreSQL/14

me@myMac:/Library/PostgreSQL/14$ ./uninstall-postgresql.app/

-bash: ./uninstall-postgresql.app/: is a directory  

me@myMac:/Library/PostgreSQL/14$ open ./uninstall-postgresql.app/

LSOpenURLsWithRole() failed with error -10810 for the file /Library/PostgreSQL/14/uninstall-postgresql.app.  

me@myMac:/Library/PostgreSQL/14$ open -a ./uninstall-postgresql.app/

Unable to find application named './uninstall-postgresql.app/'  

me@myMac:/Library/PostgreSQL/14$ open -a uninstall-postgresql.app/

Unable to find application named 'uninstall-postgresql.app/'  

me@myMac:/Library/PostgreSQL/14$ sudo open uninstall-postgresql.app/

Password:
LSOpenURLsWithRole() failed with error -10810 for the file /Library/PostgreSQL/14/uninstall-postgresql.app.  

me@myMac:/Library/PostgreSQL/14$ cd /Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS/

me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ install

install            install_name_tool  installvst
install-info       installer  

me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ installer

Usage: installer [-help] [-dominfo] [-volinfo] [-pkginfo] [-allowUntrusted] [-dumplog]
                 [-verbose | -verboseR] [-vers] [-config] [-plist]
                 [-file <pathToFile>] [-lang <ISOLanguageCode>] [-listiso]
                 [-showChoicesXML] [-applyChoiceChangesXML <pathToFile>]
                 [-showChoicesAfterApplyingChangesXML <pathtoFile>]
                 -pkg <pathToPackage>
                 -target <[DomainKey|MountPoint]>  

me@myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ installbuilder.sh

-bash: installbuilder.sh: command not found  

Solution

  • 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  
    

    ...as the other answers in my OP suggest, 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.