# （官方教程）macOS如何卸载postgresql

**URL:** <https://forum.beginner.center/t/topic/1118>\
**Category:** 🛠工具与编程\
**Tags:** macos, postgresql\
**Created:** [2024 年6 月 12 日 02:13 UTC](https://forum.beginner.center/t/topic/1118 "2024-06-12T02:13:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

作者： ![doggie](https://forum.beginner.center/user_avatar/forum.beginner.center/doggie/32/550_2.png) [@doggie](https://forum.beginner.center/u/doggie)\
发布日期： [2024 年6 月 12 日 02:13 UTC](https://forum.beginner.center/t/topic/1118/1 "2024-06-12T02:13:27Z")

</div>

> 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码， 原文地址 [www.enterprisedb.com](https://www.enterprisedb.com/docs/supported-open-source/postgresql/uninstalling/#uninstalling-postgresql-on-mac)

> PostgreSQL 安装程序会在 PostgreSQL 安装目录中创建一个卸载程序。您可以在 Windows 和 Mac 主机上卸载 PostgreSQL。

##### 注意

如果您使用 Stack Builder 安装了任何与 PostgreSQL 配合使用的应用程序，则必须卸载每个应用程序。使用安装过程中为该应用程序创建的卸载程序。

## Windows 上卸载 PostgreSQL

1. 在 Windows 控制面板中，打开“卸载或更改程序”对话框。

2. 右键点击 **PostgreSQL** ，从上下文菜单中选择 **卸载/更改** 。

3. 您可以删除整个应用程序或单个组件。

4. 当卸载程序完成时，选择 **确定** 。

## Mac 上卸载 PostgreSQL

以下说明适用于您使用 EDB 的交互式 Mac 安装程序安装 PostgreSQL 的情况。

- 如果您使用了其他安装程序，请参考 [macOS 文档](https://support.apple.com/guide/mac-help/install-and-uninstall-other-apps-mh35835/mac) 获取卸载应用的说明。

- 如果您使用 [Homebrew](https://brew.sh/)，请使用 `brew uninstall` 命令卸载 PostgreSQL 及相关软件包。使用 `brew list` 查看已安装内容。

在 Mac 系统上卸载 PostgreSQL：

##### 数据不会被删除

此卸载程序会移除应用程序，但为了避免数据丢失，会保留 Postgres 数据目录和用于管理安装的 postgres 用户。卸载结束时，卸载程序会显示一条确认消息，告知未删除数据目录或用户。

1. 调用卸载程序：

2. 系统会提示输入密码。如果您的用户具有 macOS 管理员权限，请输入密码。否则，输入具有管理员权限的用户名和密码。

3. 对安装程序作出回应：

4. 当卸载程序完成时，选择 **确定** 。
