Blog entries tagged with 'mac'

  • 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
    
  • Mac OS X: decoder jpeg not available

    By Nuno Mariz, on 26 January 2007 @ 12:07
    If you are using PIL(Python Imaging Library) on Mac OS X(Tiger), you will probably have a "decoder jpeg not available" when resizing a jpeg image.
    This probably means that PIL doesn't have JPEG support, because libjpeg wasn't found when PIL was being configured.
    Here is the solution:
    • Download, compile and install jpeglib and zlib
    • Edit PIL setup.py and change to:
      JPEG_ROOT = "/usr/local/include"
      ZLIB_ROOT = "/usr/local/include"
      
    • Compile:
      python setup.py build_ext -i
      
    • Test:
      python selftest.py
      
    • If the result is something like this:
      "57 tests passed."
      
    • You are ready to go:
      python setup.py install
      
  • Terminal colors on Mac

    By Nuno Mariz, on 23 August 2006 @ 23:33
    Trivial but useful.
    If you are using bash, just edit your .profile (explanation):
    # colors
    export CLICOLOR=1
    export TERM=xterm-color
    export LSCOLORS=gxgxcxdxbxegedabagacad  # cyan directories
    export PS1='\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;36m\\]\\w\\[\\033[00m\\]\\$ '
    
  • iMic for my Mac mini

    By Nuno Mariz, on 21 September 2005 @ 15:27
    iMic
    I think that is very weird that Mac mini doesn't have a mic or a simple line-in interface, i had to wait for 15 days and pay for the iMic 53 €. For those who doesn't know what it is:
    The iMic universal audio adapter is a USB device that adds stereo input and output to your Mac or PC. Connect virtually any microphone or sound input device to your iBook, PowerBook, PowerMac or other Mac or PC with a USB port. Yes, iMic supports both Mic level and line level input. It also supports line level output for connecting speakers or an external recording device.
  • Apple's G5 versus x86, Mac OS X versus Linux

    By Nuno Mariz, on 2 September 2005 @ 14:59
    Mac OS X
    I've found an interesting article comparing Apple's G5 versus x86 and Mac OS X versus Linux. Basically resumes to this:
    Workstation, yes; Server, no.

    The G5 is a gigantic improvement over the previous CPU in the PowerMac, the G4e. The G5 is one of the most superscalar CPUs ever, and has all the characteristics that could give Apple the edge, especially now that the clock speed race between AMD and Intel is over. However, there is still a lot of work to be done.

    The server performance of the Apple platform is, however, catastrophic. When we asked Apple for a reaction, they told us that some database vendors, Sybase and Oracle, have found a way around the threading problems. We'll try Sybase later, but frankly, we are very sceptical. The whole "multi-threaded Mach microkernel trapped inside a monolithic FreeBSD cocoon with several threading wrappers and coarse-grained threading access to the kernel", with a "backwards compatibility" millstone around its neck sounds like a bad fusion recipe for performance.

    Workstation apps will hardly mind, but the performance of server applications depends greatly on the threading, signalling and locking engine. I am no operating system expert, but with the data that we have today, I think that a PowerPC optimised Linux such as Yellow Dog is a better idea for the Xserve than Mac OS X server.
    No more mysteries:
    Apple's G5 versus x86, Mac OS X versus Linux Part One, Part Two

Tags related