How to Create the Initial Postgresql Database?

How to Install PostgreSQL

You can use brew to install PostgreSQL:

  $ brew install postgresql

Start the process

You can use brew services to manage your processes like this:

  $ brew services start postgresql

Create the initial database

If you try starting the PostgreSQL console (using psql) and get the following error:

  psql: error: could not connect to server: FATAL:  database "user" does not exist

then you need to create the initial database using:

  $ createdb