Install Postgres on Mac
PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness. It runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows. It is fully ACID compliant, has full support for foreign keys, joins, views, triggers, and stored procedures (in multiple languages). It includes most SQL:2008 data types, including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR, DATE, INTERVAL, and TIMESTAMP. It also supports storage of binary large objects, including pictures, sounds, or video. It has native programming interfaces for C/C++, Java, .Net, Perl, Python, Ruby, Tcl, ODBC, among others, and exceptional documentation.
Download the postgresql package
You can go to following link to download the packageĀ and select the postgresql version and your operating system (Mac OS) or use wget to download it via command line
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads#macosx
wget https://get.enterprisedb.com/postgresql/postgresql-9.6.3-3-osx.dmg
You might also like: How to install postgresql 9.6 on centos 7
InstallĀ postgres on mac
Now you need to install the postgresql package. Just double click on the downloaded package and follow the instructions. You need to provide the password for postgres superuser password.
Set environment variable for mac
You need to set environment variable in order to work with postgresql through command line.
Open terminal in your mac and the open profile file with any editor and paste the below line in your profile file
(Profile file can be .profile or .bash_profile in your home directory)
export PATH=/Library/PostgreSQL/9.6/bin/:$PATH
Then source your profile file or logout and login again.
Then try to login with postgres user and password.
psql -U postgres -h localhost
Password for user postgres:
psql (9.6.3)
Type "help" for help.
postgres=#
Now postgresql database is setup and you can login and create new users and password.
If you got some issues installing postgresql on mac please feel free to comment below.
Read Also: How to backup postgresql database
Leave a Reply