从 Mac OSX Lion 完全卸载 PostgreSQL 9.0.4?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8037729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 23:11:05  来源:igfitidea点击:

Completely uninstall PostgreSQL 9.0.4 from Mac OSX Lion?

macospostgresqlosx-lionuninstall

提问by Ramy

This question may look like a duplicate of: How to uninstall postgresql on my Mac (running Snow Leopard)however, there are two major differences. I'm running Lion and I'm trying to uninstall PostgreSQL 9.0.4. I've looked at the last question and the link that it referenced, but I did not find a file called "uninstall-postgresql" when I run this command:

这个问题可能看起来像重复:How to uninstall postgresql on my Mac (running Snow Leopard)但是,有两个主要区别。我正在运行 Lion 并且正在尝试卸载 PostgreSQL 9.0.4。我查看了最后一个问题及其引用的链接,但在运行此命令时没有找到名为“uninstall-postgresql”的文件:

sudo find / -name "*uninstall-*"  

So, I assume this means that the uninstall process for 9.0.4 is different than that of 8.x.

因此,我认为这意味着 9.0.4 的卸载过程与 8.x 的卸载过程不同。

I've seen a couple of posts in different places describing a method for manual uninstallation but, similarly, some of the directories/files referenced are not present on my machine.

我在不同的地方看到过几篇文章描述了手动卸载的方法,但类似地,我的机器上不存在一些引用的目录/文件。

Any assistance or direction you can provide would be greatly appreciated.

您可以提供的任何帮助或指导将不胜感激。

Just for reference, this is the link the other poster used to uninstall postgres from snow leopard. As I tried to step through these commands, most of them choked with some variant of "command not found".

仅供参考,这是另一张海报用于从雪豹卸载 postgres 的链接。当我尝试逐步执行这些命令时,它们中的大多数都被“找不到命令”的某些变体所困扰。



UPDATE:

更新:

In addition to brew uninstall postgres, should I remove any of the following files/directories manually? Keep in mind I want to completely wipe the slate clean, no data files/database tables or anything.

除了brew uninstall postgres,我是否应该手动删除以下任何文件/目录?请记住,我想彻底清除石板,没有数据文件/数据库表或任何东西。

> sudo find / -name "*postgres*"             
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/Library/Ruby/Gems/1.8/doc/activerecord-3.1.1/rdoc/lib/active_record/connection_adapters/postgresql_adapter_rb.html
/Library/Ruby/Gems/1.8/doc/activerecord-3.1.1/ri/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter/postgresql_version-i.ri
/Library/Ruby/Gems/1.8/doc/arel-2.2.1/rdoc/lib/arel/visitors/postgresql_rb.html
/Library/Ruby/Gems/1.8/gems/activerecord-3.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb
/Library/Ruby/Gems/1.8/gems/arel-2.2.1/lib/arel/visitors/postgresql.rb
/Library/Ruby/Gems/1.8/gems/arel-2.2.1/test/visitors/test_postgres.rb
/Library/Ruby/Gems/1.8/gems/railties-3.1.1/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml
/Library/Ruby/Gems/1.8/gems/railties-3.1.1/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml
/Library/WebServer/Documents/postgresql
/Library/WebServer/Documents/postgresql/html/app-postgres.html
/Library/WebServer/Documents/postgresql/html/postgres-user.html
/private/etc/apache2/users/postgres.conf
/private/var/db/dslocal/nodes/Default/groups/_postgres.plist
/private/var/db/dslocal/nodes/Default/sharepoints/postgres's Public Folder.plist
/private/var/db/dslocal/nodes/Default/users/_postgres.plist
/private/var/db/dslocal/nodes/Default/users/postgres.plist
/System/Library/DirectoryServices/DefaultLocalDB/Default/groups/_postgres.plist
/System/Library/DirectoryServices/DefaultLocalDB/Default/users/_postgres.plist
/Users/postgres
/Users/remcat/dev/working/startwire/vendor/plugins/foreign_keys/lib/foreign_keys/postgresql_adapter.rb
/Users/remcat/Library/Application Support/CrashReporter/postgres_DCCEF98F-4602-5FF7-964F-5E717AC007B4.plist
/Users/remcat/Library/Caches/Homebrew/postgresql-9.0.4.tar.bz2
/Users/remcat/Library/Caches/Metadata/Safari/History/http:%2F%2Fwww.postgresql.org%2Fdocs%2Fcurrent%2Fstatic%2Findex.html.webhistory
/Users/remcat/Library/Logs/CrashReporter/postgres_2011-11-06-194716_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/CrashReporter/postgres_2011-11-06-194742_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/CrashReporter/postgres_2011-11-06-194757_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/CrashReporter/postgres_2011-11-06-194958_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/CrashReporter/postgres_2011-11-06-203352_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/CrashReporter/postgres_2011-11-06-203359_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/DiagnosticReports/.postgres_2011-11-06-194716_Ramys-MacBook-Pro.crash.plist
/Users/remcat/Library/Logs/DiagnosticReports/.postgres_2011-11-06-194742_Ramys-MacBook-Pro.crash.plist
/Users/remcat/Library/Logs/DiagnosticReports/.postgres_2011-11-06-194757_Ramys-MacBook-Pro.crash.plist
/Users/remcat/Library/Logs/DiagnosticReports/.postgres_2011-11-06-194958_Ramys-MacBook-Pro.crash.plist
/Users/remcat/Library/Logs/DiagnosticReports/.postgres_2011-11-06-203352_Ramys-MacBook-Pro.crash.plist
/Users/remcat/Library/Logs/DiagnosticReports/.postgres_2011-11-06-203359_Ramys-MacBook-Pro.crash.plist
/Users/remcat/Library/Logs/DiagnosticReports/postgres_2011-11-06-194716_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/DiagnosticReports/postgres_2011-11-06-194742_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/DiagnosticReports/postgres_2011-11-06-194757_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/DiagnosticReports/postgres_2011-11-06-194958_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/DiagnosticReports/postgres_2011-11-06-203352_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Logs/DiagnosticReports/postgres_2011-11-06-203359_Ramys-MacBook-Pro.crash
/Users/remcat/Library/Saved Application State/org.postgresql.pgadmin.savedState
/usr/bin/postgres_real
/usr/include/postgres_ext.h
/usr/include/postgresql
/usr/include/postgresql/internal/postgres_fe.h
/usr/include/postgresql/server/postgres.h
/usr/include/postgresql/server/postgres_ext.h
/usr/include/postgresql/server/postgres_fe.h
/usr/lib/postgresql
/usr/local/Library/Aliases/postgres
/usr/local/Library/Formula/postgresql.rb
/usr/local/var/postgres
/usr/local/var/postgres/postgresql.conf
/usr/share/devicemgr/backend/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
/usr/share/devicemgr/backend/vendor/rails/railties/configs/databases/postgresql.yml
/usr/share/devicemgr/webserver/gems/gems/eventmachine-0.12.10/lib/em/protocols/postgres3.rb
/usr/share/man/man1/postgres.1.gz
/usr/share/postgresql
/usr/share/postgresql/postgres.bki
/usr/share/postgresql/postgres.description
/usr/share/postgresql/postgres.shdescription
/usr/share/postgresql/postgresql.conf
/usr/share/postgresql/postgresql.conf.sample

采纳答案by James Allman

homebrew Installer

自制安装程序

Assuming you installed PostgreSQL with homebrewas referenced in check status of postgresql server Mac OS Xand how to start postgresql server on mac os x: you can use the brew uninstall postgresqlcommand.

假设您homebrew按照检查 postgresql 服务器 Mac OS X 的状态以及如何在 mac os x 上启动 postgresql 服务器中的引用安装了 PostgreSQL :您可以使用该brew uninstall postgresql命令。

EnterpriseDB Installer

企业数据库安装程序

If you used the EnterpriseDB installerthen see the other answerin this thread.

如果您使用了EnterpriseDB 安装程序,请参阅此线程中的其他答案

The EnterpriseDB installer is what you get if you follow "download" links from the main Postgres web site. The Postgres team releases only source code, so the EnterpriseDB.com companybuilds installers as a courtesy to the community.

如果您点击来自Postgres 主网站的“下载”链接,您将获得 EnterpriseDB 安装程序。Postgres 团队只发布源代码,因此EnterpriseDB.com 公司构建安装程序是对社区的一种礼貌。

Postgres.app

Postgres.app

You may have also used Postgres.app.

您可能还使用过Postgres.app.

This double-clickable Mac app contains the Postgres engine.

这个可双击的 Mac 应用程序包含 Postgres 引擎。

回答by user1181328

The following is the un-installation for PostgreSQL 9.1 installed using the EnterpriseDB installer. You most probably have to replace folder /9.1/ with your version number. If /Library/Postgresql/doesn't exist then you probably installed PostgreSQL with a different method like homebrewor Postgres.app.

以下是使用EnterpriseDB 安装程序安装的 PostgreSQL 9.1 的卸载。您很可能必须用您的版本号替换文件夹 /9.1/。如果/Library/Postgresql/不存在,那么您可能使用不同的方法安装了 PostgreSQL,例如homebrewPostgres.app

To remove the EnterpriseDB One-Click install of PostgreSQL 9.1:

要删除 PostgreSQL 9.1 的 EnterpriseDB 一键式安装:

  1. Open a terminal window. Terminal is found in: Applications->Utilities->Terminal
  2. Run the uninstaller:

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

    If you installed with the Postgres Installer, you can do:

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

    It will ask for the administrator password and run the uninstaller.

  3. Remove the PostgreSQL and data folders. The Wizard will notify you that these were not removed.

    sudo rm -rf /Library/PostgreSQL
    
  4. Remove the ini file:

    sudo rm /etc/postgres-reg.ini
    
  5. Remove the PostgreSQL user using System Preferences -> Users & Groups.

    1. Unlock the settings panel by clicking on the padlock and entering your password.
    2. Select the PostgreSQL user and click on the minus button.
  6. Restore your shared memory settings:

    sudo rm /etc/sysctl.conf
    
  1. 打开终端窗口。终端位于:应用程序->实用程序->终端
  2. 运行卸载程序:

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

    如果您使用 Postgres 安装程序安装,您可以执行以下操作:

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

    它将要求输入管理员密码并运行卸载程序。

  3. 删除 PostgreSQL 和数据文件夹。向导会通知您这些未删除。

    sudo rm -rf /Library/PostgreSQL
    
  4. 删除ini文件:

    sudo rm /etc/postgres-reg.ini
    
  5. 使用 System Preferences -> Users & Groups 删除 PostgreSQL 用户。

    1. 通过单击挂锁并输入密码来解锁设置面板。
    2. 选择 PostgreSQL 用户并单击减号按钮。
  6. 恢复您的共享内存设置:

    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.

这应该是全部!卸载向导会删除所有图标和启动应用程序文件,因此您不必担心这些。

回答by Do Nhu Vy

I don't use the same version, but uninstall actions are the same: Looking for file uninstall-postgresqlinside directory

我不使用相同的版本,但卸载操作是相同的:在目录中查找文件卸载 postgresql

/Library/PostgreSQL/9.6

enter image description here

在此处输入图片说明

then run it.

然后运行它。

enter image description here

在此处输入图片说明

(Screenshot in macOS 10.13)

(macOS 10.13 中的截图)

then

然后

sudo rm -rf /Library/PostgreSQL/

to delete all unnecessary directory.

删除所有不必要的目录。

回答by Susana Silva Santos

This blog postexplains very well:

这篇博文解释得很好:

(just replace 9.X by your version. e.g: 9.6)

(只需用您的版本替换 9.X。例如:9.6)

A. If installed PostgreSQL with homebrew, enter brew uninstall postgresql

A. 如果用homebrew安装了 PostgreSQL ,输入brew uninstall postgresql

B. If you used the EnterpriseDB installer, follow the following step.

B. 如果您使用 EnterpriseDB安装程序,请按照以下步骤操作。

Run the uninstaller on terminal window: sudo /Library/PostgreSQL/9.X/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh

在终端窗口运行卸载程序: sudo /Library/PostgreSQL/9.X/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh

C. If installed with Postgres Installer, do:

C. 如果使用 Postgres 安装程序安装,请执行以下操作:

open /Library/PostgreSQL/9.X/uninstall-postgresql.app

打开 /Library/PostgreSQL/9.X/uninstall-postgresql.app

Remove the PostgreSQL and data folders. The Wizard will notify you that these were not removed.

删除 PostgreSQL 和数据文件夹。向导会通知您这些未删除。

sudo rm -rf /Library/PostgreSQL

Remove the ini file:

删除ini文件:

sudo rm /etc/postgres-reg.ini

Remove the PostgreSQL user using System Preferences -> Users & Groups.

使用System Preferences -> Users & Groups删除 PostgreSQL 用户

Unlock the settings panel by clicking on the padlock and entering your password. Select the PostgreSQL user and click on the minus button. Restore your shared memory settings: sudo rm /etc/sysctl.conf

通过单击挂锁并输入密码来解锁设置面板。选择 PostgreSQL 用户并单击减号按钮。恢复您的共享内存设置:sudo rm /etc/sysctl.conf

回答by Fernando Munoz

I was not able to uninstall PostgreSQL 9.0.8. But I finally found this. (I installed Postgres using homebrew)

我无法卸载 PostgreSQL 9.0.8。但我终于找到了这个。(我使用自制软件安装了 Postgres)

brew list

Look for the correct folder name. Something like.

查找正确的文件夹名称。就像是。

postgresql9

Once you find the correct name do:

找到正确的名称后,请执行以下操作:

brew uninstall postgresql9

That should uninstall it.

那应该卸载它。

回答by Dhammika

Uninstallation :

卸载:

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

Removing the data file :

删除数据文件:

sudo rm -rf /Library/PostgreSQL

Removing the configs :

删除配置:

sudo rm /etc/postgres-reg.ini

And thats it.

就是这样。

回答by Trinadh Koya

open terminal and type the below command and hit enter

打开终端并输入以下命令并按回车键

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

回答by Tom Clearingbear

If you installed using the graphical installer by BigSQL from the official postgres siteandif you installed in the default location...

如果您使用来自官方 postgres 站点的 BigSQL图形安装程序进行安装,并且安装在默认位置...

You can find your uninstaller in your home directory: /Users/<yourusername/PostGreSQL/uninstall/

您可以在主目录中找到卸载程序: /Users/<yourusername/PostGreSQL/uninstall/

回答by elixir

Incase you have multiple versions of Postgres installed on your machine. You can remove all via brewcommand as:

如果您的机器上安装了多个版本的 Postgres。您可以通过以下brew命令删除所有内容:

brew uninstall --force postgresql