Install PostgreSQL 13 on mac OS and getting started with database activity

    Install PostgreSQL using Homebrew

    Install PostgreSQL latest verion by running brew install postgresql on your Terminal window Downloading and installing may take some time because homebrew will also update its packages and will take care of the dependencies needed.

    $ brew update
    $ brew installpostgresql

    Using a LaunchAgent and plist to Launch PostgreSQL at startup

    Create user-specific LaunchAgents directory with this command

    $ mkdir -p ~/Library/LaunchAgents

    Now you’ll need to create a symbolic link from the script that actually allows Postgres to run to the LaunchAgents directory. A symbolic link is similar to creating a new copy of a file for use in another directory, but since the link is ‘symbolic’, the link is just a forwarding address: any request made to that symbolic link location is actually “forwarded along” or redirected to where the real file actually resides.

    Link to the plist (property list) file that was generated by Home-brew and place that new symbolic link in LaunchAgents with this command:

    $ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents

    Finally, we load the new symbolic link’ed LaunchAgent file using the launchctl load command.

    $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

    Starting and Stopping and Checking status of PostgreSQL

    brew services stop postgresql
    brew services stop postgresql
    pg_ctl -D /usr/local/var/postgres  status

    psql connection and check list of databases 

    $ psql postgres


    Install PgAdmin4 for Mac OS and start to add database server

    Download dmg file from the following link.

    give username: <computer user name> and password as your desktop password

    Recent Articles


    Related Stories

    Leave A Reply

    Please enter your comment!
    Please enter your name here

    Stay on op - Ge the daily news in your inbox