Installing Postgres on MacOS with Brew

This is what I followed to install postgres: https://gist.github.com/ibraheem4/ce5ccd3e4d7a65589ce84f2a3b7c23a3

Pre-Reqs

brew doctor
brew update

Installing

brew install postgres
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents

Create aliases:

alias pg_start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
  1. alias pg_stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"

This alias is only set for that terminal window, so to set this permanently, find your shell path by:

  1. echo $SHELL
    

Then you can append the alias to the computer shell file. For me, this was ~/.zshrc

Note: Make sure to echo the alias and use “>>” to append, not “>” which completely wipes the file with the text. This is what I did, and unfortunately, all the past things I added to my shell file were erased and it could not be undone.

 

0 comments on “Installing Postgres on MacOS with BrewAdd yours →

Leave a Reply

Your email address will not be published.