In this post, You will learn how to install PostgreSQL and pgAdmin on Mac operating system. pgAdmin is an administrative tool to manage your database, import and export data and write SQL queries.
Install PostgreSQL on Mac –
To installing PostgreSQL on Mac, we will use the Postgres.App. This is a open source Mac application for installing PostgreSQL and PostGIS extension for Geo data.
- Visit the https://postgresapp.com/downloads.html and click on the download button to download the disk image file with .dmg extension.
2. Double click on the .dmg file and drag and drop it into the Applications folder.
3. Now, Go to your Applications folder on Mac and Double click on the Postgres icon to open it. Then click on Initialize to create and start the PostgreSQL database. You can also check the small elephant icon on the menu bar at top right to check if the database is running. By default postgreSQL creates a database for you with the name postgres.
4. If you want to include PostgreSQL command line tools then run the following commands on your terminal. Copy the code as a single line and paste it on the terminal and hit enter. You can also find the code from here – https://postgresapp.com/
sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
5. The default settings of the postgres database is this –
Install pgAdmin on Mac –
Postgres.App does not include the pgAdmin tool. So you have to download it yourself.
- Go to the pgAdmin mac download page – https://www.pgadmin.org/download/pgadmin-4-macos/
2. Select the latest version and on the next page click on the pgadmin .dmg file to download.
3. Double click the .dmg file and agree the terms. Then drag and drop the pgAdmin 4 app elephant icon to the Application folder.
4. Go to the Application folder and double click on the pgAdmin 4 icon to open it. Then click on the servers > PostgreSQL > Databases > postgres .If during the installation process, you have been asked to create a user and password then please do so. I have done it before so it did not asked me for it.
5. To know how to use the pgAdmin, please read this post that I wrote few days ago – How to use pgAdmin for PostgreSQL.
If you like this post then please share it with others and subscribe to our blog below to learn more about SQL.
Related Posts –
- How to install PostgreSQL and pgAdmin on Windows.
- How to use pgAdmin for PostgreSQL.
- Create a Database and a Table in PostgreSQL.