- In your command-line run the command:
brew install postgresql - Read the Caveats section that is outputted to the Terminal.
- Run the command:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents - Open your zsh config file:
subl ~/.zshrc - At the bottom of the file, create two new aliases to start and stop your postgres server. They could look something like this:
alias pg-start="launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
alias pg-stop="launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist"
from the man ln command
The ln utility creates a new directory entry (linked file) which has the same modes as the original file. It is useful for maintaining multiple copies of a file in many places at once without using up storage for the
copies''; instead, a linkpoints'' to the original copy. There are two types of links; hard links and symbolic links. How a link ``points'' to a file is one of the differences between a hard and symbolic link.
from the man launchctl command
launchctl interfaces with launchd to manage and inspect daemons, angents and XPC services.