How to install PostgreSQL on macOS
There are multiple sources you can use to install Postgres on your Mac, we will be using one of them i.e., homebrew.
If you don't know what homebrew is, it's a package manager for macOS, and it's convenient to use and manage packages on Mac.
To install brew, you can paste the following bash command on your terminal, or you can follow the instructions on their site.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
now that you have brew installed, you can run the following command to install Postgresql:
brew install postgresql@15
note that I've specified a version number of 15, if you want to install some other version of Postgres then you will have to mention that version after @. This version number is explicitly mentioned.
use this command to start the Postgres service
brew services start postgresql@15
you can check all the services using :
brew services list
you should be able to see the
postgresql@15 service with the status as
to stop it, run :
brew services stop postgresql@15
now you should be able to use Postgres locally on your Mac, you can start by checking the version of psql using the following command to check whether it's installed.
this should return the current version of psql installed on your Mac.
I hope this was helpful. Have a great day!
If you found this article helpful, I would be grateful for your support.
"Buy me some paneer curry"
I'd love to read your thoughts on this article!!!