Home / Tutorials / How to Install PostgreSQL 13 in MacOS Big Sur via Homebrew
How to Install PostgreSQL 13 in MacOS Big Sur via Homebrew cover

How to Install PostgreSQL 13 in MacOS Big Sur via Homebrew

5 mins


2 years ago



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 https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 
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 postgresql@11
brew install postgresql@12

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! 🍻
notion avatar

Ahmad Aziz

Week-end developer currently experimenting with web, mobile, and all things programming.

Support Us

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

Related Tutorials

Code Snippets

Collection of Laravel, AlpineJS, VueJS, Tailwind CSS, Flutter snippets and more. New snippets added every day.
View Snippets

Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your web projects
View Components

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this