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
繁體地址,請注明出處:http://hk.pswp.cn/bicheng/82232.shtml
英文地址,請注明出處:http://en.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 的…