Mac Postgresql install - kapilpipaliya/ruby_notes GitHub Wiki

install postgresql 11 on mac:

% brew install postgresql@11
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/manifests/69.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/blobs/sha256:25a1ec460d42
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/manifests/1.1.1k
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:0a75e0
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:940e7c2b8
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/11/manifests/11.12
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/11/blobs/sha256:32be
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Installing dependencies for postgresql@11: icu4c, [email protected] and readline
==> Installing postgresql@11 dependency: icu4c
==> Pouring icu4c--69.1.arm64_big_sur.bottle.tar.gz
🍺  /opt/homebrew/Cellar/icu4c/69.1: 259 files, 73.3MB
==> Installing postgresql@11 dependency: [email protected]
==> Pouring [email protected]_big_sur.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺  /opt/homebrew/Cellar/[email protected]/1.1.1k: 8,071 files, 18MB
==> Installing postgresql@11 dependency: readline
==> Pouring readline--8.1.arm64_big_sur.bottle.tar.gz
🍺  /opt/homebrew/Cellar/readline/8.1: 48 files, 1.7MB
==> Installing postgresql@11
==> Pouring [email protected]_big_sur.bottle.tar.gz
==> /opt/homebrew/Cellar/postgresql@11/11.12/bin/initdb --locale=C -E UTF-8 /opt
==> Caveats
This formula has created a default database cluster with:
  initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@11
For more details, read:
  https://www.postgresql.org/docs/11/app-initdb.html

postgresql@11 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@11 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/postgresql@11/bin:$PATH"' >> ~/.zshrc

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


To have launchd start postgresql@11 now and restart at login:
  brew services start postgresql@11
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /opt/homebrew/var/postgresql@11 start
==> Summary
🍺  /opt/homebrew/Cellar/postgresql@11/11.12: 3,205 files, 41.2MB
==> Caveats
==> postgresql@11
This formula has created a default database cluster with:
  initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@11
For more details, read:
  https://www.postgresql.org/docs/11/app-initdb.html

postgresql@11 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@11 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/postgresql@11/bin:$PATH"' >> ~/.zshrc

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


To have launchd start postgresql@11 now and restart at login:
  brew services start postgresql@11
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /opt/homebrew/var/postgresql@11 start

start postgresql

% brew services start postgresql@11
==> Tapping homebrew/services
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 1311, done.
remote: Counting objects: 100% (190/190), done.
remote: Compressing objects: 100% (133/133), done.
remote: Total 1311 (delta 74), reused 164 (delta 54), pack-reused 1121
Receiving objects: 100% (1311/1311), 385.73 KiB | 1.68 MiB/s, done.
Resolving deltas: 100% (551/551), done.
Tapped 1 command (28 files, 467.4KB).
==> Successfully started `postgresql@11` (label: homebrew.mxcl.postgresql@11)