[[TOC]] = Installation Guidelines: Mac - Developer (Manual) = == Install Apple Xcode Developer Tools == You will need [http://developer.apple.com/technologies/tools/ Apple's Xcode Developer Tools] (version 4.1 or later for Lion, 3.2 or later for Snow Leopard, or 3.1 or later for Leopard), found at the Apple Developer Connection site, on your Mac OS X installation CDs/DVD, or in the [http://itunes.apple.com/us/app/xcode/id497799835 Mac App Store]. Using the latest available version that will run on your OS is highly recommended. Ensure that the optional components for command line development are installed ("Command Line Tools" in the newest, "UNIX Development", plus "System Tools" in less-new versions, or "Command Line Support" in older ones). === Install Command Line Tools === The Xcode Command Line Tools need to be installed after Xcode has been installed. To install the Command Line Tools: 1. Open Xcode 2. Open Xcode -> Preferences, and select the Download tab. 3. Under the Components tab, click the Install button next to Command Line Tools. Note that this may require you to create a developer account with Apple to complete the download. // If you do not see Command Line Tools under the Components tab you can run the command {{{xcode-select --install}}} in the terminal to preform the same operation. // // Caution: The Xcode download is over 3GB. // // LR October 2014: This step may not work for the last release of Xcode. // == Install !MacPorts == The !MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system. Installing !MacPorts will make installing some of the dependencies easier. * [http://www.macports.org/install.php Download and Install] !MacPorts Before installing any new software with !MacPorts, make sure to run the following command to ensure that the Portfiles are up to date. {{{ sudo port -v selfupdate }}} Note, if you get this error... {{{ Warning: xcodebuild exists but failed to execute }}} ... when running port, and have had old versions of Xcode that used the \Developer directory, you may need to run this command to update the Xcode directory. {{{ sudo /usr/bin/xcode-select -switch /Applications/Xcode.app }}} == Install GIS tools == For some GIS features of Eden (e.g. if you would rather use PostgreSQL with PostGIS instead of MySQL) you are required to install the [http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries GDAL framework]. [http://trac.osgeo.org/geos/ GEOS] is also required, and is a dependency of shapely. '''!MacPorts Install (recommended)''' {{{ sudo port install gdal geos }}} == Install Python == The current preferred version for Python for developers is version 2.7. If you are running the default Apple Python installation, several dependencies will fail to install. Be sure to install a version of Python, from the [http://python.org Python Website], or using !MacPorts. '''!MacPorts Install (recommended)''' {{{ sudo port install python27; sudo port select --set python python27 }}} == Install Python packages == '''!MacPorts install (recommended)''' {{{ sudo port install py27-lxml py27-shapely py27-reportlab py27-xlrd py27-xlwt py-serial py27-tweepy py27-dateutil py27-pil }}} '''!EasyInstall''' You can use [http://peak.telecommunity.com/DevCenter/EasyInstall easy_install] or [http://www.pip-installer.org/ pip] for these installations. Be sure to include the "export" line, otherwise these will fail to install because they build for powerPC by default. {{{ export ARCHFLAGS="-arch i386 -arch x86_64" STATIC_DEPS=true sudo easy_install python-dateutil sudo easy_install lxml sudo easy_install shapely sudo easy_install reportlab sudo easy_install xlrd sudo easy_install xlwt sudo easy_install pyserial sudo easy_install tweepy sudo easy_install pil }}} == Install PostgreSQL + PostGIS extensions == If you want to use PostgreSQL - PostGIS (for which you will need GDAL, above): * Install the one clickInstaller sponsored by EnterpriseDB PostgreSQL and select also installation of PostGIS, following [http://schwuk.com/articles/2009/09/10/psycopg2-on-os-x this post] * Please note - If you are installing on Mac OSX Lion, and you encounter errors upon installing the Postgresql through EnterpriseDB version specified in the above link, you could go to [http://www.enterprisedb.com/downloads/postgres-postgresql-downloads this link] and download EnterpriseDB Postgresql 9.3.1 * Install the Python database driver [http://initd.org/psycopg/ psycopg2] for Postgres 9.3 as the web2py default pg8000 has a few mappings missing. Use that as the driver instead. == Install Git == Check whether you already have git installed by: {{{ which git }}} If not then... '''!MacPorts Install (recommended)''' {{{ sudo port install git-core +doc +gitweb }}} == Trouble? == * {{{lxml}}} can give trouble on OS X. Try: * {{{STATIC_DEPS=true sudo easy_install lxml}}} (adapted from [http://blog.ianbicking.org/2008/12/10/lxml-an-underappreciated-web-scraping-library/ this blog post]) * remove other {{{libxml2}}} versions, such as may have been installed by {{{fink}}} or !MacPorts - ONLY works in unmodified Python setup. In case you have modified your Python you must link some how the python directory with /frameworks/python otherwise lxml will not being found(not tested) == Next == Configure git; install Web2Py and Sahana Eden: * InstallationGuidelines/Developer/PostPython