PostGIS is the spatial extension to the PostGreSQL database.
PostGIS 2 adds geometrical, geographical and topological types, and functions operating thereon, to the PostGreSQL database. The 2.0 release also provides raster handling and basic 3D geometry capacities (TIN and polyhedra).
To install postgis2, paste this in macOS terminal after installing MacPorts
sudo port install postgis2