- How to uninstall PostgreSQL
- How to remove PostgreSQL using Terminal
- The easiest way to remove PostgreSQL from Mac
- Conclusion
- How to Uninstall PostgreSQL with Homebrew (macOS)
- Has this been helpful to you?
- Uninstall Postgres 10 on macOS – EnterpriseDB installer
- 2 Answers 2
- postgres user
- Backup/Export
- Uninstaller app
- data folder
- Applications folder
- Как я могу полностью удалить Postgres со своего Mac?
- 2 ответа 2
- Пробные
- Как удалить postgresql с OS X?
How to uninstall PostgreSQL
PostgreSQL is a powerful open source database system that leverages and extends the SQL language, combined with a host of features to securely store and scale the most complex data workloads. 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.
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.
This is a special uninstaller that will help you to completely uninstall any application from Mac along with their caches, logs, login items, preferences and browsers extensions.
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 app in the future.
To manage the complete Postgre uninstallation first of all, you should stop the 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, open Utilities subfolder, and launch Terminal. After that run the uninstaller using the following command:
Or try this one
If you get the message that this file does not exist, then skip to the second PostgreSQL removal way. 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. If for some reason this method does not work for you or you simply do not want to waste your time we recommend to uninstall PostgreSQL with the App Cleaner & Uninstaller tool, which will automatically find all support files of PostgreSQL and remove the application entirely. Keep reading this article to find out more about this tool.
The easiest way to remove PostgreSQL from Mac
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.
For the automatic uninstallation method, you need to use a special free cleanup application – App Cleaner & Uninstaller. This software automatically gathers all the service files of each app and allows you to uninstall them with one click. With this uninstaller, you can uninstall PostgreSQL without any extra steps and it will not take much of your time. 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 of the application window. 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 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 waste your time searching and removing them manually. That is why if you have already deleted PostgreSQL in a regular way, just by dragging-and-dropping it into the Trash, we recommend you to switch to the Remaining Files tab. That section will display all the leftovers of previously incorrectly deleted applications. So that is the perfect option to quickly get some free space.
Conclusion
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.
App Cleaner & Uninstaller
Uninstall any Mac application in 2 minutes.
Источник
How to Uninstall PostgreSQL with Homebrew (macOS)
Learn how to completely uninstall (and reinstall) PostgreSQL with Homebrew on Mac.
If you’re having problems starting up your PostgreSQL databases running on Homebrew, such as the classic:
You can try restarting PostgreSQL services:
But that often doesn’t work.
Sometimes the fastest way to solve the problem by uninstalling PostgreSQL entirely, and reinstalling a fresh version.
Uninstall PostgreSQL with Homebrew
This will show you how to completely remove PostgreSQL with Homebrew.
Warning: If you have any important projects on your machine that run on PostgreSQL databases, now is the time to back them up, because the following will wipe out PostgreSQL completely!
First Open your Terminal, and run the following command to make sure that PostgreSQL is actually installed with Homebrew:
If it doesn’t show up, you’re in the wrong tutorial!
Before you move on, run the following two commands to make sure that your Homebrew installation is healthy, and up to date:
brew doctor is Homebrew’s self-diagnosis tool.
Now uninstall PostgreSQL with Homebrew with this command:
When the uninstaller is finished, remove all your local PostgreSQL files with these two commands:
PostgreSQL is now completely gone from your machine.
Install PostgreSQL with Homebrew
If you want to reinstall PostgreSQL with Homebrew again, run another update on Homebrew (for good measure):
I know you just updated Homebrew, but sometimes I have to do it twice to make it work (I don’t know why).
And then install PostgreSQL:
Now you can start PostgreSQL services with this command:
To test that it works, we can create the default database:
Connect to PostgreSQL by running this command:
If everything went well your terminal will output the following (or similar):
Has this been helpful to you?
You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊
Источник
Uninstall Postgres 10 on macOS – EnterpriseDB installer
Title says it all… How to completely remove a Postgres cluster from a macOS computer?
I used the installer app provided by EnterpriseDB as a courtesy to the community.
This uninstallation question has been asked multiple times on Stack Overflow. But those questions and answers are years out-of-date.
2 Answers 2
postgres user
The user account named postgres (by default) created by the installer is actually a macOS user account.
- Apple allows deleting a user account in the more recent versions of macOS: System Preferences > Users & Groups > — button in list, after authenticating with padlock icon in lower corner.
- In older macOS versions that do not delete user accounts, you may be able to hide that user account.
Every other trace of Postgres can be removed.
Backup/Export
Of course, first backup your database with a tool like pgBackup. And/or export your data.
Uninstaller app
The installer app provided by EnterpriseDB does install an app named Uninstaller . Find it in the Postgres folder, probably located at the root Library folder (not the Library folder in your home folder).
Run that uninstaller app, and supply your macOS system password. After the run, the data folder remains as that is owned by the postgres user rather than your regular macOS user. The uninstaller app reminds you of this fact.
data folder
Select that data folder in the Finder, and choose File > Move to trash . When prompted, provide your own macOS user account password.
Delete that outer Postgres folder(s) that contained data .
Applications folder
Remove the PostgreSQL 10 folder in your Applications folder if it remains. Again, provide your own macOS user account password.
Источник
Как я могу полностью удалить Postgres со своего Mac?
После использования программы установки Mac для Postgres у меня возникало жуткое поведение с Postgres. Похоже, что существует уже наполовину запеченная установка Postgres, которая уже была там и остается там после того, как я удалил версию установщика Mac GUI из /Applications и /Library. Часть пугающего поведения заключалась в том, что после неоднократного тычка и подталкивания невозможно было заставить конкретного пользователя проходить аутентификацию в соответствии с его поведением — но это имеет смысл, если у меня было две параллельные базы данных Postgres, одна для которых я (успешно) настраивал пользователя с помощью конкретный пароль, и тот, который не был установлен этой базы данных. Теперь, когда эта версия удалена, у меня есть несколько двоичных файлов Postgres, которые вылетают или выдают ошибки, если я пытаюсь их использовать:
Я не использовал MacPorts, Fink или другие инсталляторы Unix, кроме Homebrew, в жизни этого Mac. Homebrew отказывается от права собственности на установку Postgres:
Поэтому, несмотря на то, что я установлен, у меня сломана установка Postgres, которую я хотел бы полностью стереть
Как я могу полностью стереть Postgres из моей системы, чтобы я мог установить его с помощью установщика и получить одну установку Postgres вместо жутких полутора установок?
2 ответа 2
Похоже, вы только что удалили несколько файлов в Finder.
Предполагая, что вы использовали установщик отсюда, вы должны следовать инструкциям в руководстве по удалению:
Пробные
Если вам нужно удалить PostgreSQL, вы можете в любое время запустить деинсталлятор, созданный в процессе установки. Обратите внимание, что деинсталлятор никогда не удалит ваш каталог данных или учетную запись пользователя службы. Вы можете найти деинсталлятор в установочном каталоге и запустить его так же, как вы запустили инсталлятор. Обычно параметры командной строки не требуются. В Windows вы также можете запустить деинсталлятор из панели управления «Установка и удаление программ».
Другими словами, просто запустите деинсталлятор, установленный вместе с остальной частью программы.
После запуска любых деинсталляторов, следующее должно помочь вам найти любые оставшиеся файлы конфигурации или конфигурации SQL в вашем каталоге Library (общий источник странного поведения переустановки)
/Library | grep sql
Если там есть что-то, что выглядит как часть установки PostgreSQL, удаление их перед переустановкой может помочь. Иногда там скрытые папки скрыты глубже.
Кроме того, ls -l /usr/bin/psql должен предоставлять любые символические ссылки, если они есть, в случае, если приложение psql размещено в другом каталоге.
Источник
Как удалить postgresql с OS X?
Входите в psql оболочку, от имени суперпользователя и введя пароль суперпользователя.
sudo -u postgres psql
Дальше создаете базу и пользователя для работы.
Выходите из psql консоли
\q
Заходим от имени вновь созданного пользователя
psql -h localhost mytestdb my_user
Профит и обнимашки.
Рестартаните сервис postgres
brew services restart postgresql
Попробуйте зайти в оболочку.
Не получится, тогда:
Найдите файл pg_hba.conf
В нем найдите и измените строчку на
local all postgres peer
Очистите и создайте новый пароль пользователю postgres
Потом выполните
su postgres -c psql template1
Войдя в оболочку
psql> ALTER USER postgres WITH PASSWORD ‘mypass’;
какую именно строчку менять?
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal. If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect. You can
# use «pg_ctl reload» to do that.
# Put your actual configuration here
# ———————————-
#
# If you want to allow non-local connections, you need to add more
# «host» records. In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.
# CAUTION: Configuring the system for local «trust» authentication
# allows any local user to connect as any PostgreSQL user, including
# the database superuser. If you do not trust all your local users,
# use another authentication method.
# TYPE DATABASE USER ADDRESS METHOD
# «local» is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication leshiy trust
#host replication leshiy 127.0.0.1/32 trust
#host replication leshiy ::1/128 trust
Источник