Installing PostgreSQL On Mac OS

PostgreSQL is a SQL database that is used worldwide. Today we’ll be going over how to install PosgreSQL on Mac OS, however the same applies if you are on a linux based system such as Ubuntu or Fedora (Not including Homebrew since it is a Mac native tool).

Let’s begin by updating Homebrew :

$ brew update

This should ensure that Homebrew is up to date.
New lets install PostgreSQL via Homebrew:

$ brew install postgresql

Once we have Postgres installed we could use the following commands to start and stop our Postgres database:

$ brew services start postgresql
$ brew services stop postgresql

Enter the PostgreSQL CLI where you should see a resulting output ctrl + D to exit:

$ psql postgres
psql (12.2)
Type "help" for help.


Once you’ve entered the interactive terminal, you can use the following commands to achieve a number of tasks:

List your Postgres databases:

postgres=# \l

Create a new database:

postgres=# CREATE DATABASE database_name

To be continued…