Install Homebrew
Launch your terminal and type in the command below to install Homebrew. Do note that it works for both Intel MacBook and ARM-based MacBook so you don't have to worry about incompatibility.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew doctor
Install PostgreSQL
To install PostgreSQL version 13 (the latest version at the time of writing) run the command below. Do note that each new version released will still be named "postgresql".
brew install postgresql
brew install [email protected] brew install [email protected]
To start the PostgreSQL server, run the brew services command like below.
brew services start postgresql
brew services stop postgresql
brew services list
Integrate with Laravel
If you are developing a Laravel web application and you want to make use of PostgreSQL, do change the environment configuration like below. The connection should be "pgsql", the port number is 5432, the username is "postgres" and the password is empty.
DB_CONNECTION=pgsql DB_HOST=127.0.0.1 DB_PORT=5432 DB_DATABASE=your_db_name DB_USERNAME=postgres DB_PASSWORD=