brew install postgresql

该博客记录了在 macOS 上安装 PostgreSQL@12 的过程,包括其依赖库 krb5。安装过程中提到 krb5 由于 macOS 已提供而设置为 keg-only,避免与系统版本冲突。同时,为了使用 PostgreSQL@12,需要将路径添加到环境变量,并提供了相应的设置方法。安装完成后,提示可以通过 brew services 启动服务或手动运行 pg_ctl 命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 Installing dependencies for postgresql@12: krb5
==> Installing postgresql@12 dependency: krb5
==> Pouring krb5-1.19.1.big_sur.bottle.tar.gz
==> Caveats
krb5 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have krb5 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/krb5/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/krb5/sbin:$PATH"' >> ~/.zshrc

For compilers to find krb5 you may need to set:
  export LDFLAGS="-L/usr/local/opt/krb5/lib"
  export CPPFLAGS="-I/usr/local/opt/krb5/include"

For pkg-config to find krb5 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/krb5/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/krb5/1.19.1: 162 files, 5.2MB
==> Installing postgresql@12
==> Pouring postgresql@12--12.6_1.big_sur.bottle.1.tar.gz
==> /usr/local/Cellar/postgresql@12/12.6_1/bin/initdb --locale=C -E UTF-8 /usr/local/var/postgresql@12
==> Caveats
This formula has created a default database cluster with:
  initdb --locale=C -E UTF-8 /usr/local/var/postgresql@12
For more details, read:
  https://www.postgresql.org/docs/12/app-initdb.html

postgresql@12 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have postgresql@12 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/postgresql@12/bin:$PATH"' >> ~/.zshrc

For compilers to find postgresql@12 you may need to set:
  export LDFLAGS="-L/usr/local/opt/postgresql@12/lib"
  export CPPFLAGS="-I/usr/local/opt/postgresql@12/include"

For pkg-config to find postgresql@12 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/postgresql@12/lib/pkgconfig"


To have launchd start postgresql@12 now and restart at login:
  brew services start postgresql@12
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgresql@12 start
==> Summary
🍺  /usr/local/Cellar/postgresql@12/12.6_1: 3,225 files, 41.7MB
==> Caveats
==> krb5
krb5 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have krb5 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/krb5/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/krb5/sbin:$PATH"' >> ~/.zshrc

For compilers to find krb5 you may need to set:
  export LDFLAGS="-L/usr/local/opt/krb5/lib"
  export CPPFLAGS="-I/usr/local/opt/krb5/include"

For pkg-config to find krb5 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/krb5/lib/pkgconfig"

==> postgresql@12
This formula has created a default database cluster with:
  initdb --locale=C -E UTF-8 /usr/local/var/postgresql@12
For more details, read:
  https://www.postgresql.org/docs/12/app-initdb.html

postgresql@12 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have postgresql@12 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/postgresql@12/bin:$PATH"' >> ~/.zshrc

For compilers to find postgresql@12 you may need to set:
  export LDFLAGS="-L/usr/local/opt/postgresql@12/lib"
  export CPPFLAGS="-I/usr/local/opt/postgresql@12/include"

For pkg-config to find postgresql@12 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/postgresql@12/lib/pkgconfig"


To have launchd start postgresql@12 now and restart at login:
  brew services start postgresql@12
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgresql@12 start
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值