PostgreSQL is not typically problematic, but if you get some issues with it, it is recommended to reinstall the program instead of trying to fix the problem. So in this article, we are going to explain how to uninstall PostgreSQL on a Mac easily and quickly.
How to Remove PostgreSQL Using Terminal
First, you should stop Postgres server on your Mac. For this, click on the Elephant icon in the toolbar and select Shutdown server.
If you installed Postgres with its Installer, then you can use the Terminal command line to remove Postgres. For this, go to the Applications folder →Utilities → open Terminal → and run the uninstaller using the following command:
Or try this one
If you encounter the message that this file does not exist, then skip to Method 2 of PostgreSQL removal. If the command runs the uninstaller, proceed to the next steps.
Enter the administrator password to launch the uninstaller. Then follow the provided steps to remove the PostgreSQL and data folders.
Unfortunately, the root uninstaller doesn’t delete all service files of the program, so you will need to remove them manually. For this, use the commands below:
- Remove the ini file:
sudo rm /etc/postgres-reg.ini
- Remove the PostgreSQL folder from the system Library:
sudo rm -rf /Library/PostgreSQL
- Remove the PostgreSQL user. Go to System Preferences → Users & Groups → click the Lock icon and enter the administrator password to unlock settings → select the PostgreSQL and click the “-” icon.
- Restore your shared memory settings using this command: sudo rm /etc/sysctl.conf
That’s all with the first method of removal. Now, let’s learn the second method, which you will most likely find easier and more convenient.
How to Remove PostgreSQL Using App Cleaner
App Cleaner & Uninstaller is a removal tool for any kind of program on Mac. With this uninstaller, you can uninstall PostgreSQL well. Here are a few steps to do that:
- Download App Cleaner & Uninstaller and launch it.
- Confirm access to your Applications folder and it will start scanning it to find the installed apps on your Mac. Then you will see a list of apps in the left section. Find and select the PostgreSQL folder. In the right section, you can preview all executable files, support files, cache and all types of file related to PostgreSQL.
- Click the Remove or Uninstall button and confirm the removal of the selected files.
Note that App Cleaner & Uninstaller automatically detects all the support files of the apps, so you don’t need to search for and remove them manually. If you already deleted PostgreSQL in the regular way, you can find the leftovers of the program in the Remains tab.
That’s all. As we promised, easy and fast!