Install and connect PostgreSQL on Mac Os

1 min


Install PostgreSQL on Mac OS.

Install PostgreSQL on Mac Os

Installation via Homebrew:

Add to startup at startup Mac OS.

brew services start postgresql

You can also start manually:

pg_ctl -D / usr / local / var / postgres start

Reboot PostgreSQL

brew services restart postgresql

Not necessary

If autoload does not work. You can carry out such manipulations:

The startup directory is here:

Create a symlink

ln -sfv /usr/local/opt/postgresql/*.plist ~ / Library / LaunchAgents

Add to startup

launchctl load ~ / Library / LaunchAgents / homebrew.mxcl.postgresql.plist

Connect to PostgreSQL on Mac OS

Connecting on Mac OS is slightly different than Linux. Check users:
psql -l

To connect, specify Owner from the table above:

sudo psql -U Dream -d postgres

How to create a database and user, follow the instructions:
https://ploshadka.net/postgresql/

How to connect to PostgreSQL on Mac OS

On localhost, just create a database and connect to it by specifying only its name:

The rest is picked up by default.


0 Comments

Leave a Reply