# postgresql install note ```shell= $ gem i libpq ==> Summary 🍺 /usr/local/Cellar/libpq/14.5: 2,340 files, 27.9MB ==> 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 /usr/local, because conflicts with postgres formula. If you need to have libpq first in your PATH, run: echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc For compilers to find libpq you may need to set: export LDFLAGS="-L/usr/local/opt/libpq/lib" export CPPFLAGS="-I/usr/local/opt/libpq/include" ``` ```shell= $ brew install postgresql ==> Summary 🍺 /usr/local/Cellar/postgresql/14.5: 3,309 files, 44.4MB ==> Running `brew cleanup postgresql`... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). ==> Caveats ==> postgresql To migrate existing data from a previous major version of PostgreSQL run: brew postgresql-upgrade-database This formula has created a default database cluster with: initdb --locale=C -E UTF-8 /usr/local/var/postgres For more details, read: https://www.postgresql.org/docs/14/app-initdb.html To restart postgresql after an upgrade: brew services restart postgresql Or, if you don't want/need a background service you can just run: /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres ```