In this article, we’ll walk through the process of installing a Postgres database on a Mac OS X machine and set it up for Ruby on Rails development. Install Postgres Database with Homebrew. Homebrew is a popular package manager for OS X. To install Postgres with Homebrew, follow the steps below.
On Mac OSX
![Postgis Postgis](/uploads/1/2/6/7/126747554/549127129.png)
Sep 23, 2018 PostGIS 2.5.0. Author: Regina Obe 2018/09/23 in news (release, 2.5, 2.5.0) The PostGIS development team is pleased to release PostGIS 2.5.0. Although this release will work for PostgreSQL 9.4 and above, to take full advantage of what PostGIS 2.5 offers, you should be running PostgreSQL 11beta4+ and GEOS 3.7.0 which were released recently. Our software library provides a free download of PostGIS 9.3.3 for Mac. Postgis-1.5.3.tar.gz is the most frequent filename for this application's installer. The most popular version among the program users is 1.5. The size of the latest downloadable installation package is 3.6 MB. The actual developer of this free software for Mac is OSGeo project. In this article, we’ll walk through the process of installing a Postgres database on a Mac OS X machine and set it up for Ruby on Rails development. Install Postgres Database with Homebrew Homebrew is a popular package manager for OS X. PostGIS 3.0.2 came out August 15th, 2020. Binaries for versions of PostgreSQL 9.6-12 (64-bit) available in Unreleased PostGIS Versions and OSGeo downloads), installers for 9.6-12 (64-bit) are available on stackbuilder and OSGeo downloads. PostGIS 3.0.2 bundle includes.
Because of Homebrew, installation is easier on Mac. Run these two commands to install bothpostgresql and PostGIS
It is done, how nice!
Start the service
type this command to start the postgresql service.
then check if the service is up and running.
Make sure postgresql starts when mac starts up
If you don’t want to run the above start command every time you start your mac, do the following to make surepostgresql automatically starts.
- make sure you have this directory
~/Library/LaunchAgents
. (create it if it does not exist) - run
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
to create a symbolic link for postgres plistfile - run
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
to add the plist to launch control.
Postgresql should start automatically every time your mac starts.
On AWS Ubuntu
Remote login to aws ubuntu instance, then run the following:
After installation, you can create database by running
sudo -u postgres createdb DATABASE_NAME
If you want to create a specific user for a database, run
Then you can test database connection by running
psql -U USER_NAME DATABSE_NAME
Install PostGIS
After postgresql is installed and connection tested, we can install postgis:
9.* is the version of your postgresql, and 2.* the version of PostGIS
Then you can create PostGIS extension for your regular postgresql database to enable GIS functions.
In psql session, do this to enable PostGIS and check if extension is created.
Postgresql Postgis Download
Notes: if you use a created database user, make sure it has super role to create extension. If you are using GeoDjango,migrate database using django manage.py command will create the extension automatically.
Install PgAdmin III and connect to database
PgAdmin III is a s a comprehensive PostgreSQL database design and management system
go to http://www.pgadmin.org/download/macosx.php to download and installit.
After install, you can create a db connection to connect to your postgresql and PostGIS databases.
It is pretty straightforward to connect to a local database, just provide the localhost/port(default 5432) database username and password (if you have a password, or leave it empty).
If you want to connect to a remote database on AWS instance, you need to make some changes to config files
in /etc/postgresql/9.*/main/postgresql.conf add
listen_addresses='*'
in /etc/postgresql/8.2/main/pg_hba.conf add
host all all 0.0.0.0/0 md5
Because port 5432 (your postgresql port) may not be open by default security settings, you need to open it appropriately.On amazon, you can add that rule in your security group of the instance in aws console.
After the changes, you should be able to connect to your remote database from your local machine.