How to Install psql on Mac

参考链接:Here

# first step
➜ brew install libpq               
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/api/formula.jws.json

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/api/cask.jws.json

==> Fetching dependencies for libpq: icu4c@76 and krb5
==> Fetching icu4c@76
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/icu4c%4076-76.1.arm64_sequoia.bottle.tar.gz
########################################################################################################################## 100.0%
==> Fetching krb5
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/krb5-1.21.3.arm64_sequoia.bottle.tar.gz
########################################################################################################################## 100.0%
==> Fetching libpq
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libpq-17.0_2.arm64_sequoia.bottle.tar.gz
########################################################################################################################## 100.0%
==> Installing dependencies for libpq: icu4c@76 and krb5
==> Installing libpq dependency: icu4c@76
==> Pouring icu4c@76-76.1.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/icu4c@76/76.1: 277 files, 81MB
==> Installing libpq dependency: krb5
==> Pouring krb5-1.21.3.arm64_sequoia.bottle.tar.gz
🍺  /opt/homebrew/Cellar/krb5/1.21.3: 163 files, 5.6MB
==> Installing libpq
==> Pouring libpq-17.0_2.arm64_sequoia.bottle.tar.gz
==> Caveats
libpq is keg-only, which means it was not symlinked into /opt/homebrew,
because conflicts with postgres formula.

If you need to have libpq first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> /Users/rivtian/.zshrc

For compilers to find libpq you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/libpq/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/libpq/include"
==> Summary
🍺  /opt/homebrew/Cellar/libpq/17.0_2: 2,387 files, 32.3MB
==> Running `brew cleanup libpq`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> libpq
libpq is keg-only, which means it was not symlinked into /opt/homebrew,
because conflicts with postgres formula.

If you need to have libpq first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> /Users/rivtian/.zshrc

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

# final step
➜ brew link --force libpq  
Linking /opt/homebrew/Cellar/libpq/17.0_2... 381 symlinks created.

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> /Users/rivtian/.zshrc

# check psql version
➜ psql --version
psql (PostgreSQL) 17.0
posted @ 2024-11-03 15:16  RioTian  阅读(22)  评论(0编辑  收藏  举报