How to install PostgreSQL 10 on Mac

Install PostgreSQL 10 on Mac

install PostgreSQL 10 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

wget https://get.enterprisedb.com/postgresql/postgresql-10.0-1-osx.dmg

You might also like: How to install postgresql 9.6 on centos 7

Install postgres 10 on mac

Now you need to install the postgresql package. Just double click on the downloaded package and follow the instructions. You need to set 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/10/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 (10.0)
 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

Consider sharing this article: