PostgreSQL is an open source object-relational database. It is a popular database choice when using a relational database.
Installing PostgreSQL on Mac OS X is simple.
The instructions in this post were created / tested using the following sofware versions:
First, we will update Brew and then install PostgreSQL.
brew update brew install postgres
Start the PostgreSQL server in the foreground. There are optional instructions below in case you would like to start PostgreSQL automatically.
Brew initializes the database during installation.
postgres -D /usr/local/var/postgres
Cmd + T to open a new terminal tab.
whoami is surrounded by backticks, not single quotes.
Login to PostgreSQL with your user account.
AdminPack is used by PgAdmin. If you plan on using the PgAdmin UI, then installing AdminPack is a good idea.
psql postgres -c 'CREATE EXTENSION "adminpack";'
The commands below configure PostgreSQL to start automatically.
mkdir -p ~/Library/LaunchAgents ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Congrats. PostgreSQL is now installed on Mac OS X. You are now ready to start using PostgreSQL for development.
We specialize in helping professional developers, like you, expand your skill set. Our courses are focused on enabling you to learn everything necessary to use a new technology in a live, production application.
All courses are made with love in
Palo Alto, CA.
Subscribe to our newsletter