Skip to content

Instantly share code, notes, and snippets.

@leesmith
Created September 4, 2025 03:25
Show Gist options
  • Save leesmith/b95297f4e7d7ab6309333dfbd452d24c to your computer and use it in GitHub Desktop.
Save leesmith/b95297f4e7d7ab6309333dfbd452d24c to your computer and use it in GitHub Desktop.
Installing & running Postgresql via asdf on macOS

Installing & running Postgresql with asdf (via homebrew)

Install a PG version via asdf

export PKG_CONFIG_PATH="/opt/homebrew/opt/icu4c@77/lib/pkgconfig"
asdf install postgres 17.5

Create the postgresql user role

psql -U postgres
create role my_user with SUPERUSER CREATEDB CREATEROLE REPLICATION BYPASSRLS LOGIN PASSWORD NULL;

Install pg gem

gem install pg -- --with-pg-config=/Users/my_user/.asdf/installs/postgres/17.5/bin/pg_config

Starting Postgres via asdf

/Users/my_user/.asdf/installs/postgres/17.5/bin/pg_ctl -D /Users/my_user/.asdf/installs/postgres/17.5/data -l logfile start

or simply

pg_ctl start > pg.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment