PostgreSQL is not typically problematic, but if you are experiencing some issues with it, it is recommended to reinstall the application instead of trying to fix the problem. Thus, here we are going to explain how to uninstall PostgreSQL from a Mac computer easily and quickly.
Contents:
- What is PostgreSQL?
- Should I remove PostgreSQL?
- How to remove PostgreSQL using Terminal
- The easiest way to remove PostgreSQL from Mac
- FAQs
Before we start
App Cleaner & Uninstaller
What is PostgreSQL?
PostgreSQL is an open-source object-relational database system that supports both SQL (relational) and JSON (non-relational) querying. It’s widely used in web development, data analytics, geospatial applications, and high-availability enterprise systems.
With over 35 years of continuous development, PostgreSQL has stood the test of time. It was originally created at the University of California, Berkeley, and since then, a global community of developers has been improving and supporting it, making it one of the most trusted database systems in the world. According to Stack Overflow Developer Survey — in 2023, over 45% of professional developers reported using it regularly.
Today PostgreSQL has over 1 million active users and contributors across GitHub, mailing lists, and forums.
Should I remove PostgreSQL?
PostgreSQL has tons of various features designed to help developers build applications, administrators protect data integrity and create resilient environments, and help manage data regardless of dataset size. However, it can take up a lot of space — often over 100GB — due to stored databases, logs, and other files. Also, there are other reasons why you may need to uninstall PostgreSQL:
- You’re not using it. PostgreSQL often gets installed automatically with certain apps or development tools.
- You’re switching to an alternative database, for example, MySQL or SQLite.
- You want a clean setup. Developers often remove PostgreSQL when cleaning or resetting their local development environment.
How to remove PostgreSQL using Terminal
Deleting PostgreSQL just by dragging-and-dropping it into the Trash is not the correct way to uninstall apps. In this case, all the Postgre system service files will remain on your computer and keep cluttering up your disk space. Meaning, they will not let you correctly reinstall the software in the future.
If you installed Postgres with its Installer, then you can use the Terminal command line to remove Postgres. Follow these steps:- Quit PostgreSQL. For this, click on the Elephant icon in the toolbar and select Shutdown server.
- Open Terminal. You can find it in the Applications folder > Utilities.
- Run the uninstaller using the command below. Copy and paste it in the Terminal window and press Return:
- Enter the administrator password if prompted.
- Remove the ini file using this command:
sudo rm /etc/postgres-reg.ini
- Remove the PostgreSQL folder from the system Library:
sudo rm -rf /Library/PostgreSQL
- Remove the PostgreSQL user account. For this, go to System Settings → Users & Groups → select the PostgreSQL and click to delete it.
- Restore your shared memory settings using this command:
sudo rm /etc/sysctl.conf
open /Library/PostgreSQL/9.2/uninstall-postgresql.app
If you get the message that this file does not exist, try this command:
sudo /Library/PostgreSQL/9.1/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh
(Unfortunately, the root uninstaller doesn’t delete all PostgreSQL files, so you will need to remove them manually. For this, use the commands below.)
Uninstalling PostgreSQL with Terminal may be a really time-consuming process. Moreover, you might have missed some service files and left them on your Mac’s hard drive. That’s why we recommend that you uninstall PostgreSQL automatically.Keep reading this article to find out more about this method.
The easiest way to remove PostgreSQL from Mac
For this method, you need to use a special tool – App Cleaner & Uninstaller. This software automatically gathers all the service files of each application and allows you to uninstall them with a few clicks. Here’s how to use it:
- Download App Cleaner & Uninstaller and launch it.
- It will start scanning your Applications folder and show you the list of all installed apps on your Mac.
- Locate and select the PostgreSQL.
- If you switch on the Expert mode, you’ll see all the PostgreSQL client support files, like caches, preferences, etc.
- Click the Remove button.
- Confirm the removal.
Note that the app uninstaller automatically detects all the support files of the apps, so you don’t need to waste your time searching and removing them manually. That is why if you have already deleted PostgreSQL using the first method, you can find its remaining files with the uninstaller. For this, witch to the Remaining Files tab. That section will display all the leftovers of previously incorrectly deleted applications.
In this article, we provided you with two ways of uninstalling PostgreSQL from Mac. You can uninstall it manually using the Terminal, which is a time-consuming task or you can follow the instruction of automatic uninstallation. Nektony recommends using a professional App Cleaner & Uninstaller tool. This application was developed specially for fast, safe, and complete uninstallation of any no longer needed application.
FAQs
Where is Postgres installed by default on Mac?
Postgres is typically installed in the following directory on Mac:
/usr/local/pgsql
If you can’t find it there, use the following command in the Terminal to find out where Postgres is installed on your Mac:
brew info postgres
This will show you more information about the Postgres package installed by Homebrew, including the location of the data directory and the configuration files.
How do I know if PostgreSQL is running on my Mac?
To check PostgreSQL running processes, use the following command:
ps auxwww | grep postgres
How do I update Postgres on my Mac?
Follow these steps to update PostgreSQL on macOS:
- Uninstall the hold version of Postgres using the guide above.
- Download the new version of Postgres.app and double-click the downloaded .dmg.
- Follow the on-screen instruction to install the app.