Posts Learn Components Snippets Categories Tags Tools About

How to Install PostgreSQL 13 in MacOS Big Sur via Homebrew

Learn how to install PostgreSQL 13 in macOS big sur by using homebrew in few simple steps

1 year ago

5 mins read


In this post, you'll be learning how to install PostgreSQL 13 in macOS through the command line with the help of Homebrew package manager. The steps are very simple so do follow along and let's get started.

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" 
Next, do update the brew to get the latest package version from the source.
brew update
If necessary, also run brew doctor to run diagnosis to check if there are any errors.
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
If for some reason you prefer to install PostgreSQL version 11 or 12 do specify the version by appending the version number at the end.
brew install [email protected]
brew install [email protected]

To start the PostgreSQL server, run the brew services command like below.
brew services start postgresql
If you want to stop it then run the stop command.
brew services stop postgresql
Lastly, to view any running services run the services command.
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.
If you find this tutorial to be helpful do share it with others and cheers! 🍻

Alternative Tags

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️