Home > How to Tips

Completely Uninstall PostgreSQL on Mac [Terminal & Uninstaller]

Updated on Tuesday, December 3, 2024

Written by

Jessica Shee

English

Summary: This article walks you through how to uninstall PostgreSQL on Mac with Terminal or a program uninstaller - iBoysoft MagicMenu.

PostgreSQL, also known as Postgres, is a popular open-source relational database management system. It is widely used by application developers to build applications ranging from small-scale web applications to large-scale enterprise systems.

If you have installed PostgreSQL on your Mac for a project but now you don't need it anymore, or you are experiencing issues with PostgreSQL, such as conflicts with your Mac system, it is advised to uninstall it. This article will explain how to completely uninstall PostgreSQL on Mac in 2 effective ways. 

Reasons for uninstalling PostgreSQL

The main reason for uninstalling PostgreSQL is that you won't be using this tool anymore. It is always the best practice to remove unnecessary utilities from your Mac to free up Mac storage space. 

If you are not using PostgreSQL, it's unlikely that you will keep it updated. Outdated software frequently leads to conflicts and may even make your Mac exposed to malware attacks. Although PostgreSQL is not typically problematic, it is recommended to uninstall it to avoid issues in the future. 

If you know someone who could benefit from this information, please share it with them.

 

How to uninstall PostgreSQL using Terminal

Moving PostgreSQL to Trash can't completely remove it from your Mac because all the Postgre system service files will remain on your computer. To entirely uninstall PostgreSQL on your Mac, the first option is to run commands in Terminal. If you have used PostgreSQL before, using Terminal shouldn't be an issue.

How to uninstall PostgreSQL on Mac manually using Terminal:

Step 1. Shut down PostgreSQL

If the PostgreSQL server is running on your Mac, you need to shut it down before removing it. Click the elephant icon in the top menu bar and choose Shutdown server

Step 2. Launch the Terminal app

Find Terminal in Finder > Applications > Utilities and double-click the app to open a terminal window. 

Step 3. Run the uninstaller command

Because you can get macOS PostgreSQL packages from several different sources, each of them requires a different way to uninstall. 

Type the following command and press Return to initiate the PostgreSQL uninstaller. Remember to replace "15"  to the version of PostgreSQL installed on your Mac. Then type in your admin password when prompted.

To uninstall PostgreSQL 15 installed by EDB installer on Mac:

sudo /Library/PostgreSQL/15/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh

To remove the Postgres.app, the native macOS app that runs in the menubar without the need for an installer

open /Library/PostgreSQL/15/uninstall-postgresql.app

To remove PostgreSQL with Homebrew on Mac

 1.  Run the following command and look for the correct name for your PostgreSQL version such as postgresql94, postgres, and postgresql@14. 

brew list

 2.  Run the following command to uninstall Postgres with Homebrew. Replace "postgresql@14" with the name you found in the above-mentioned command.

brew uninstall postgresql@14

Step 4. Remove PostgreSQL associated files

The above command only uninstalls the PostgreSQL server but leaves service files on your Mac disk. Enter each of the commands below and hit Return one at a time.  to remove PostgreSQL-associated files. 

To remove the data folders and the ini file related to PostgreSQL software:

sudo rm -rf /Library/PostgreSQL 
sudo rm /etc/postgres-reg.ini 
To remove the local PostgreSQL files with Homebrew: 
rm -rf /usr/local/var/postgres 
rm /usr/local/var/log/postgres.log 
rm -f ~/.psqlrc ~/.psql_history

Step 5. Remove the PostgreSQL user

On macOS 13 Ventura:

1. Go to the Apple menu > System Settings > Users & Groups

2. Select the PostgreSQL user.

3. Click the i icon and choose Delete Account

On macOS Monterey or earlier:

1. Go to the Apple menu > System Preferences > Users & Groups. Click the padlock and enter your admin password to unlock the settings panel. 

2. Select the PostgreSQL user and click on the minus - button.

Step 6. Restore the shared memory settings [Optional]

Type the following commands and press Return.

sudo rm /etc/sysctl.conf

Sharing this post with your network on social media would help us reach a wider audience and make a bigger impact.

 

How to uninstall PostgreSQL on Mac with one click

If you have difficulty following the process described above, the other way to completely remove PostgreSQL from your Mac is to use iBoysoft MagicMenu. It can find all files related to PostgreSQL and remove the application without any leftovers. This method is very friendly for non-technical users as it doesn't involve any Terminal commands.

After closing the PostgreSQL server, here is how to uninstall it easily with iBoysoft MagicMenu. 

Step 1. Download and install iBoysoft MagicMenu on your Mac

iBoysoft MagicMenu is available for free downloading in the App Store. The software will prompt to ask you to install iBoysoft MagicMene Helper to be able to use all features. Click Install iBoysoft MagicMenu Helper and follow the onscreen instructions.

Step 2.  Completely uninstall PostgreSQL with one click

Postgres.app includes psql, a command line client for PostgreSQL. There are plenty of great graphical clients available for PostgreSQL such as pgAdmin 4 and Postico. 

Find the client software you use in Finder and right-click on it. Choose Uninstall in the drop-down menu. iBoysoft MagicMenu will delete pgAdmin 4 (or other PostgreSQL client software) and scan your system to find all PostgreSQL files and remove them from your Mac. 

Conclusion

If you want to reinstall PostgreSQL or just don't need it anymore, it is necessary to completely uninstall PostgreSQL on your Mac. You can run commands to delete PostgreSQL from your Mac, but keep in mind that the commands vary depending on how you installed PostgreSQL on your Mac. 

The easiest and quickest way to remove PostgreSQL from your Mac is to use iBoysoft MagicMenu. It can uninstall PostgreSQL client software and clean up its related files with one single click. In addition to an app uninstaller, iBoysoft MagicMenu is packed with a wide variety of functions such as file compressor, duplicate file finder, duplicate photo cleaner, and image converter. Explore this amazing right-click menu enhancer today!

If you enjoyed reading this post, please help us reach more people by sharing it on your social media profiles. Thank you for your support!