Last active
December 23, 2015 00:49
-
-
Save smnorris/6556665 to your computer and use it in GitHub Desktop.
Install OS X open source geo, starting from scratch. Tested on fresh install of OS X 10.8.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Mac OSX 10.8 geo setup script | |
# loads geo stuffs, mostly through homebrew | |
################### | |
# Before running: | |
# - Install Xcode from the Mac App Store. | |
# - Install the Xcode Command Line Tools by opening Xcode, | |
# Xcode → Preferences → Downloads → Components → | |
# "Install" button to the right of "Command Line Tools". | |
################### | |
# note the archflags | |
export ARCHFLAGS="-arch x86_64" | |
# Install homebrew | |
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)" | |
# Install git (osx provided isn't particularly current) | |
brew install git | |
# Modify path to make sure we are pointing at homebrew apps not defaults | |
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" | |
# Check if brew is good to go | |
brew doctor | |
read -p "If brew doctor looks good, press [Enter] key to continue..." | |
# handy utilities, and a simple brew test | |
brew install wget | |
# python | |
brew install python --with-brewed-openssl | |
# handy python modules | |
pip install virtualenv | |
pip install numpy | |
# node, node modules | |
brew install node | |
npm install -g topojson | |
ECHO "Download ESRI file geodatabase API" | |
ECHO "Current version (Sept 2013) is 1.3, but it doesn't currently work with gdal." | |
ECHO "***Use version 1.2 instead***" | |
ECHO "http://www.esri.com/apps/products/download/" | |
read -p "Once file geodatabase api zip file downloaded, press [Enter] key to continue..." | |
# Copy fgdb api stuff to /usr/local | |
cd /tmp | |
unzip ~/Downloads/FileGDB_API_1_3-64.zip | |
cp -R /tmp/FileGDB_API/include/* /usr/local/include/ | |
cp -R /tmp/FileGDB_API/lib/* /usr/local/lib/ | |
# install gdal, with unsupported for fgdb api driver support | |
# note that the --complete install option bails on an xml parser xerces-c | |
# needed for GML (not exactly a pressing need). | |
# Therefore, just do the basic install. (load pg later) | |
cd | |
brew install gdal --enable-unsupported | |
# presuming gdal installed successfully, load shapely, fiona, tilestache | |
pip install shapely | |
pip install fiona | |
pip install tilestache | |
# time to install the database | |
brew install postgresql | |
initdb /usr/local/var/postgres/9.2/main -E utf8 -U postgres -W | |
# add these to bash_profile for easy db start/stop | |
cat <<EOF >> $HOME/.bash_profile | |
alias start_pg='pg_ctl -D /usr/local/var/postgres/9.2/main start -l /usr/local/var/postgres/9.2/main/server.log' | |
alias stop_pg='pg_ctl -D /usr/local/var/postgres/9.2/main stop -s -m fast' | |
EOF | |
source $HOME/.bash_profile | |
# install postgis | |
brew install postgis | |
# start server and setup a default postgis enabled db with user postgres/postgres | |
start_pg | |
createdb postgis -U postgres | |
psql -d postgis -U postgres -c "CREATE EXTENSION postgis;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment