Blog entries tagged with 'postgis'

  • PostgreSQL and PostGIS installation from source on Mac OS X Lion

    By Nuno Mariz, on 19 June 2012 @ 11:59

    This is a cookbook for installing PostgreSQL and PostGIS on Mac OS X Lion from source, as alternative you can install the binaries from EnterpriseDB or KyngChaos.

    You don't have to install all packages but if you're using Django will be useful.

    Requirements

    Xcode with "Command Line Tools": Installation via Xcode > Preferences > Downloads.

    PostgreSQL

    1. Create the postgres user via System Preferences(for simplicity), use "postgres" as username.
    2. Compiling and installing PostgreSQL:
      $ curl -O http://ftp.postgresql.org/pub/source/v9.1.3/postgresql-9.1.3.tar.gz
      $ tar xzfp postgresql-9.1.3.tar.gz
      $ cd postgresql-9.1.3
      $ ./configure CC=/usr/bin/clang CXX=/usr/bin/clang++ "CFLAGS=-arch x86_64" "LDFLAGS=-arch x86_64" "CXXFLAGS=-arch x86_64"
      $ make
      $ sudo make install
      $ cd ..
      
    3. Create PostgreSQL Database Cluster:
      $ sudo mkdir /usr/local/pgsql/data
      $ sudo chown postgres /usr/local/pgsql/data
      $ sudo -u postgres /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
      
    4. Start PostgreSQL Server:
      $ sudo -u postgres /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data start
      
    5. After installation add to .profile or .zshrc:
      export PATH=/usr/local/pgsql/bin:$PATH
      

    PROJ4

    PROJ.4 is a library for converting geospatial data to different coordinate reference systems.

    $ curl -O http://download.osgeo.org/proj/proj-4.8.0.tar.gz
    $ curl -O http://download.osgeo.org/proj/proj-datumgrid-1.5.zip
    $ tar xzfp proj-4.8.0.tar.gz
    $ cd proj-4.8.0/nad
    $ unzip ../../proj-datumgrid-1.5.zip
    $ cd ..
    $ ./configure CC=/usr/bin/clang CXX=/usr/bin/clang++ "CFLAGS=-arch x86_64" "LDFLAGS=-arch x86_64" "CXXFLAGS=-arch x86_64"
    $ make
    $ sudo make install
    $ cd ..
    

    GEOS

    GEOS is a C++ library for performing geometric operations.

    $ curl -O http://download.osgeo.org/geos/geos-3.3.3.tar.bz2
    $ tar xjfp geos-3.3.3.tar.bz2
    $ cd geos-3.3.3
    $ ./configure CC=/usr/bin/clang CXX=/usr/bin/clang++ "CFLAGS=-arch x86_64" "LDFLAGS=-arch x86_64" "CXXFLAGS=-arch x86_64"
    $ make
    $ sudo make install
    $ cd ..
    

    GDAL

    GDAL is an open source geospatial library that has support for reading most vector and raster spatial data formats. GEOS and PROJ.4 should be installed prior to building GDAL.

    $ curl -O http://download.osgeo.org/gdal/gdal-1.9.1.tar.gz
    $ tar xzfp gdal-1.9.1.tar.gz
    $ cd gdal-1.9.1
    $ ./configure CC=/usr/bin/clang CXX=/usr/bin/clang++ "CFLAGS=-arch x86_64" "LDFLAGS=-arch x86_64" "CXXFLAGS=-arch x86_64"
    $ make
    $ sudo make install
    $ cd ..
    

    PostGIS

    Spatial extensions for PostgreSQL.

    $ curl -O http://postgis.refractions.net/download/postgis-1.5.4.tar.gz
    $ tar xzfp postgis-1.5.4.tar.gz
    $ cd postgis-1.5.4
    $ ./configure CC=/usr/bin/clang CXX=/usr/bin/clang++ "CFLAGS=-arch x86_64" "LDFLAGS=-arch x86_64" "CXXFLAGS=-arch x86_64"
    $ make
    $ sudo make install
    

Tags related