macOS 安装 PostgreSQL

在这里插入图片描述

文章目录

    • 安装
      • 安装信息
    • 验证
    • GUI 工具下载


安装

最简单的方式是通过 brew 安装

brew install postgresql@17

该版本在 brew 上的详情页:https://formulae.brew.sh/formula/postgresql@17

你也可以根据需要,搜索 安装更新版本


如果你没有安装 brew,建议安装,参考:
https://blog.csdn.net/lovechris00/article/details/121613647


安装信息

关注日志,包含安装地址、配置环境变量的语句,以及启动方法

% brew install postgresql@17
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/17/manifests/17.5
##################################################################################################################### 100.0%
==> Fetching dependencies for postgresql@17: lz4, xz, zstd, libunistring and gettext
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/manifests/1.10.0-1
##################################################################################################################### 100.0%
==> Fetching lz4
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/blobs/sha256:5bd143b7b784989e549637ea4e484af85ba481e640dde69bc35f3843ae
##################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/xz/manifests/5.8.1
##################################################################################################################### 100.0%
==> Fetching xz
==> Downloading https://ghcr.io/v2/homebrew/core/xz/blobs/sha256:dcd7823f2624cbcd08f55c232097a79300c7d76ab5969004db1a4785c6c
##################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/manifests/1.5.7
##################################################################################################################### 100.0%
==> Fetching zstd
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/blobs/sha256:b039c851ef22617804576274872c33727ebb3a0b5e0db2ab62e0d8a97
##################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/manifests/1.3
##################################################################################################################### 100.0%
==> Fetching libunistring
==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/blobs/sha256:3cd26bae2d5fcf61294f14c18e5e7ec773a59ed1bf710fb92
##################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.25
##################################################################################################################### 100.0%
==> Fetching gettext
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/blobs/sha256:8dba9424a9409d3ba085acccfd8c88c196e31e31944c32c1d811cf
##################################################################################################################### 100.0%
==> Fetching postgresql@17
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/17/blobs/sha256:2c9bea8ba80e55662401b8fdb3895162395c552980bf06b0
##################################################################################################################### 100.0%
==> Installing dependencies for postgresql@17: lz4, xz, zstd, libunistring and gettext
==> Installing postgresql@17 dependency: lz4
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/manifests/1.10.0-1
Already downloaded: /Users/es/Library/Caches/Homebrew/downloads/8e11e90eb21a06e0f199af9d80e011e3693c77dd353b2477579d95c8471a5802--lz4-1.10.0-1.bottle_manifest.json
==> Pouring lz4--1.10.0.arm64_sequoia.bottle.1.tar.gz
🍺  /opt/homebrew/Cellar/lz4/1.10.0: 24 files, 713.5KB
==> Installing postgresql@17 dependency: xz
==> Downloading https://ghcr.io/v2/homebrew/core/xz/manifests/5.8.1
Already downloaded: /Users/es/Library/Caches/Homebrew/downloads/86a115cc1d43ff8a480fd907f812e70a403e1675d8a7223f61bbb08cbd2adc27--xz-5.8.1.bottle_manifest.json
==> Pouring xz--5.8.1.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/xz/5.8.1: 96 files, 2.5MB
==> Installing postgresql@17 dependency: zstd
==> Downloading https://ghcr.io/v2/homebrew/core/zstd/manifests/1.5.7
Already downloaded: /Users/es/Library/Caches/Homebrew/downloads/596a67b1677f62a8e24e6fdfa7c879891221cb8261242f4355fb4deff1a2ec39--zstd-1.5.7.bottle_manifest.json
==> Pouring zstd--1.5.7.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/zstd/1.5.7: 32 files, 2.2MB
==> Installing postgresql@17 dependency: libunistring
==> Downloading https://ghcr.io/v2/homebrew/core/libunistring/manifests/1.3
Already downloaded: /Users/es/Library/Caches/Homebrew/downloads/a570da63bc1839c7e217f203abd54d4d873ebd6b99f6e88994d0e79e2ebe987c--libunistring-1.3.bottle_manifest.json
==> Pouring libunistring--1.3.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libunistring/1.3: 59 files, 5.4MB
==> Installing postgresql@17 dependency: gettext
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.25
Already downloaded: /Users/es/Library/Caches/Homebrew/downloads/344607fc5b91bb0c1287d07bb445cc40cc465a163a52e12eed3cc5cd60498f78--gettext-0.25.bottle_manifest.json
==> Pouring gettext--0.25.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/gettext/0.25: 2,418 files, 27.7MB
==> Installing postgresql@17
==> Pouring postgresql@17--17.5.arm64_sequoia.bottle.tar.gz
==> Downloading https://formulae.brew.sh/api/formula.jws.json
==> /opt/homebrew/Cellar/postgresql@17/17.5/bin/initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@17
==> Caveats
This formula has created a default database cluster with:initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@17When uninstalling, some dead symlinks are left behind so you may want to run:brew cleanup --prune-prefixpostgresql@17 is keg-only, which means it was not symlinked into /opt/homebrew, because this is an alternate version of another formula.If you need to have postgresql@17 first in your PATH, run:echo 'export PATH="/opt/homebrew/opt/postgresql@17/bin:$PATH"' >> ~/.zshrcFor compilers to find postgresql@17 you may need to set:export LDFLAGS="-L/opt/homebrew/opt/postgresql@17/lib"export CPPFLAGS="-I/opt/homebrew/opt/postgresql@17/include"To start postgresql@17 now and restart at login:brew services start postgresql@17
Or, if you don't want/need a background service you can just run:LC_ALL="C" /opt/homebrew/opt/postgresql@17/bin/postgres -D /opt/homebrew/var/postgresql@17
==> Summary
🍺  /opt/homebrew/Cellar/postgresql@17/17.5: 3,820 files, 72MB
==> Running `brew cleanup postgresql@17`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

我在 ./zshrc 中配置下面环境变量:

export PATH="/opt/homebrew/opt/postgresql@17/bin:$PATH" 
export LDFLAGS="-L/opt/homebrew/opt/postgresql@17/lib"
export CPPFLAGS="-I/opt/homebrew/opt/postgresql@17/include"

验证

查看是否安装成功:

psql --version

% psql --version
psql (PostgreSQL) 17.5 (Homebrew)

然后可以进行一系列启动等操作


GUI 工具下载

如果你要是用 GUI 连接查看信息,可以使用 PgAdmin、DBeaver 等客户端工具:

  • PgAdmin :https://www.pgadmin.org/download/
  • DBeaver : https://dbeaver.io
  • macOS 下的数据库客户端工具
    https://blog.csdn.net/lovechris00/article/details/118418864

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/bicheng/82232.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

安装openresty使用nginx+lua,openresty使用jwt解密

yum install -y epel-release yum update yum search openresty # 查看是否有可用包 yum install -y openresty启动systemctl start openresty验证服务状态systemctl status openresty设置开机自启systemctl enable openrestysystemctl stop openresty # 停止服务 system…

全球化 2.0 | 云轴科技ZStack助力中东智慧城市高性能智能安防云平台

在全球智慧城市加速建设的背景下,中东某大型城市通过部署云轴科技ZStack Cloud云平台,成功实现公共安全视频监控系统(CCTV)的智能化升级。该平台以弹性计算、GPU智能调度、高可用架构为核心,支撑千路高清视频流处理及人…

Day35打卡 @浙大疏锦行

知识点回顾: 三种不同的模型可视化方法:推荐torchinfo打印summary权重分布可视化进度条功能:手动和自动写法,让打印结果更加美观推理的写法:评估模式 作业:调整模型定义时的超参数,对比下效果。…

嵌入式软件-如何做好一份技术文档?

嵌入式软件-如何做好一份技术文档? 文章目录 嵌入式软件-如何做好一份技术文档?一.技术文档的核心价值与挑战二.文档体系的结构化设计三.精准表达嵌入式特有概念四. **像管理代码一样管理文档**,代码与文档的协同维护五.质量评估与持续改进5.…

css五边形

五边形 .fu{width: 172rpx;height: 204rpx;overflow: hidden;border-radius: 10rpx;clip-path: polygon(0% 0%, 100% 0%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); }六边形 clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);

【Java高阶面经:微服务篇】1.微服务架构核心:服务注册与发现之AP vs CP选型全攻略

一、CAP理论在服务注册与发现中的落地实践 1.1 CAP三要素的技术权衡 要素AP模型实现CP模型实现一致性最终一致性(Eureka通过异步复制实现)强一致性(ZooKeeper通过ZAB协议保证)可用性服务节点可独立响应(支持分区存活)分区期间无法保证写操作(需多数节点可用)分区容错性…

头歌软工导论作业

一.集成测试和确认测试 第1关:集成测试 1、 集成测试的主要方法有CD A、 自顶向下集成方法 B、 自底向上集成方法 C、 渐增式测试方法 D、 非渐增式测试方法 2、 目前在进行集成测试时普遍采用非渐增式测试方法。B A、 √ B、 3、 自底向上集成策略是从主控制模…

MFC:获取所有打印机的名称(打印机模块-1)

背景: 在一个 MFC 应用程序中,列出本地系统中安装的打印机,并检测是否存在“Microsoft Print to PDF”或“Microsoft XPS Document Writer”虚拟打印机。如果有,则选择其中一个作为默认或后续操作对象;如果没有&#…

设计模式-行为型模式(详解)

模板方法 模板方法模式,它在一个抽象类中定义了一个算法(业务逻辑)的骨架,具体步骤的实现由子类提供,它通过将算法的不变部分放在抽象类中,可变部分放在子类中,达到代码复用和扩展的目的。 复用: 所有子类可以直接复…

STM32中的IIC协议和OLED显示屏

串口通信协议的缺点 串口通信通常需要至少三条线(TX、RX和GND),而 I2C 总线仅需要两条信号线(SDA和SCL); 串口通信仅支持一对一通信,而 I2C 总线支持多机通信,允许单个主机与多个从…

30个性能优化方案

1.用String.format拼接字符串 不知道你有没有拼接过字符串,特别是那种有多个参数,字符串比较长的情况。 比如现在有个需求:要用get请求调用第三方接口,url后需要拼接多个参数。 以前我们的请求地址是这样拼接的: S…

docker中部署Universal Media Server (UMS)

Universal Media Server (UMS) 本身主要是作为桌面服务程序开发的(主要面向 Java GUI DLNA 播放),但确实可以通过 Docker 进行部署。虽然官方没有提供 Docker 镜像,但社区有一些可用的方式可以在 Docker 中运行它。 下面是一个可…

配置文件,xml,json,yaml,我该选哪个?

文章目录 一、核心特性对比二、性能与生态系统三、适用场景与选型建议四、替代方案与趋势五、总结 在软件开发中,配置文件格式的选择直接影响开发效率和维护成本。XML、JSON、YAML 是目前主流的三种格式,但它们各有适用场景和局限性。本文将从语法特性、…

产品迭代与放弃的判断:MVP、PMF 与 Scale Fit 的三重验证

在创业和产品管理的世界里,一个永恒的难题是:什么时候应该继续投入资源进行产品迭代?什么时候又该果断放弃? 这是一个既关乎战略方向,又涉及资源分配的核心命题。许多初创公司或产品团队往往在错误的方向上坚持太久&a…

DAY 35 模型可视化与推理

知识点回顾: 三种不同的模型可视化方法:推荐torchinfo打印summary权重分布可视化进度条功能:手动和自动写法,让打印结果更加美观推理的写法:评估模式 作业:调整模型定义时的超参数,对比下效果。…

20250523-BUG-E1696:无法打开元数据文件“platform.winmd(已解决)

BUG:E1696:无法打开元数据文件“platform.winmd(已解决) 最近在用VisualStudio2022打开一个VisualStudio2017的C老项目后报了这个错,几经周折终于解决了,以下是我用的解决方法: 将Debug从Win32改…

Hellorobot 移动操作机器人开源实践:HPR 模型 + 全栈资源,降低家庭机器人开发门槛

Hellorobot在DobbE框架中扮演了重要的技术支柱角色。通过其尖端的模块化设计和高效算法优化,Hellorobot为家庭机器人领域注入了强大的创新动力。DobbE框架的核心技术——Home Pretrained Representations (HPR) 模型,得益于Hellorobot的技术支持&#xf…

onnx模型转入rknn3399平台上工作记录

1.rknn虚拟环境使用时报错问题 使用rknn17环境的报错: ImportError: libdc1394.so.22: cannot open shared object file: No such file or directory 参考链接:https://blog.csdn.net/2301_80032564/article/details/142316410 创作软连接: …

杰发科技AC7840——CSE硬件加密模块使用(1)

1. 简介 2. 功能概述 3. 简单的代码分析 测试第二个代码例程 初始化随机数 这里的CSE_CMD_RND在FuncID中体现了 CSE_SECRET_KEY在17个用户KEY中体现 最后的读取RNG值,可以看出计算结果在PRAM中。 总的来看 和示例说明一样,CSE 初次使用,添加…

AI要掌握的知识

AI(人工智能)是一个跨学科的复杂领域,其知识体系涵盖理论基础、技术工具和实践应用等多个层面。以下从核心知识模块、技术工具、实践方向等角度,详细梳理 AI 从业者需要掌握的知识体系: 一、数学基础:AI 的…