Steps to install and configure Postgres on Mac for developing against locally
-
Install homebrew
-
Install postgres
brew install postgresql
-
Create a database
createdb test
-
Create SSL certificates
cd /opt/homebrew/var/postgresql@14 openssl genrsa -aes128 2048 > server.key openssl rsa -in server.key -out server.key chmod 400 server.key openssl req -new -key server.key -days 365 -out server.crt -x509 cp server.crt root.crt
-
Update config in
/opt/homebrew/var/postgresql@14/postgresql.conf
listen_addresses = '*' password_encryption = md5 ssl = on ssl_ca_file = 'root.crt' ssl_cert_file = 'server.crt' ssl_crl_file = '' ssl_crl_dir = '' ssl_key_file = 'server.key' ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL' # allowed SSL ciphers ssl_prefer_server_ciphers = on
-
Start Postgres server
/opt/homebrew/opt/postgresql@14/bin/postgres -D /opt/homebrew/var/postgresql@14