Showing posts with label OS X. Show all posts
Showing posts with label OS X. Show all posts

8/08/2012

Installing rgdal for R on Mac

rgdal provides an interface between R and the GDAL/OGR library, which provides extensive support for a variety of geospatial formats. It is extremely useful for data import and export tasks, particularly because it can read projection information (from .prj files). However, to use rgdal, one must install GDAL and other frameworks on your system first. This is a guide for how to install rgdal on a Mac.

1. Download and install the GDAL, PROJ, and GEOS frameworks: http://www.kyngchaos.com/software/frameworks. The easiest method is just to install all the frameworks using the GDAL 1.9 Complete installer.

2. Verify the directories in which the frameworks were installed. For me, the directories were as follows:
  • /Library/Frameworks/GDAL.framework/
  • /Library/Frameworks/GEOS.framework/
  • /Library/Frameworks/PROJ.framework/

3. Verify that GCC is installed. The easiest way to do so is by opening up Terminal and typing gcc --version. If you receive an error, it means that you are either missing GCC or Terminal can't find it. The easiest way to get GCC on a Mac is to install the Command Line Tools for XCode. This is what I did, and for me, when I run the command gcc --version, the output is "i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)".

4.  Download the latest version of rgdal from CRAN: http://cran.r-project.org/web/packages/rgdal/index.html.

5. Now, in Terminal, cd to the location of the tarball for rgdal and run the following command: 
R CMD INSTALL --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib' rgdal_0.7-12.tar.gz

6. If the installation script runs without error in Terminal, you're ready to load the package in R using
library(rgdal).

Note: if upon attempting to load the rgdal library in R using you receive an error of the form "Error: package ‘rgdal’ is not installed for 'arch=x86_64'", this means that rgdal was installed for a different architecture of R (32-bit instead of 64-bit in this case). To install rgdal explicitly for the 64-bit architecture, you can modify Step 5 above by adding in the <code>--arch x86_64</code> option:
R --arch x86_64 CMD INSTALL --configure-args='--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib' rgdal_0.7-12.tar.gz

8/07/2012

My favorite applications for OS X

I've recently upgraded to the mid-2012 version of the MacBook Pro, which has given me a chance to completely install all my programs from scratch, as well as re-evaluate the applications I use. After significant research, here are the the applications that I have found extremely useful for Mac OS X, by category:


Productivity and Organization Tools:
  • Evernote: great note-taking and web clipping utility that synchs with the web and across devices (including iPhone). Also check out Evernote Trunk for many additional, productivity-enhancing add-ons.
  • Papers2: pdf organization program (costs ~$50 with student discount)
  • 1Password: password manager (costs $50)
  • Transmit: Mac OS X FTP client

Text Editors:
  • Aquamacs: An editor for text, HTML, LaTeX, C++, Java, Python, R, Perl, Ruby, PHP, and other languages (I use this mostly for LaTeX and Python). Based on GNU Emacs platform. 
  • TextWrangler: professional HTML and text editor (and for other languages).

Graphics:
  • Seashore: open source image editor for Mac. It is simpler to use than GIMP because it seeks to provide basic image editing needs, not to replace professional image editing products.
  • Gimp: GNU Image Manipulation Program that is great open-source replacement for Photoshop. Useful for photo retouching, image composition and image authoring.
Note: Gimp requires X11, an application that implements the X Window System. However, Apple no longer provides X11 support for Mountain Lion directly (as X11.app). However, one can download XQuartz, which is an open source version of X11 that runs on Mountain Lion and allows to run all X11-based applications in Mac OS X.


PDF Reader:
  • Skim: PDF reader and note-taker. Integrates with Timestamper for Mac application developed for   recording timing of pdf (Beamer) slides during a lecture.

Music and Videos:
  • Spotify: stream music for free.
  • VLC: open source and cross-platform multimedia player.

Security:
  • ClamXav: free virus checker for Mac OS X. Based upon open source ClamAV engine.

Developer Tools:
  • XCode: Apple's developer environment. Includes GCC, the GNU Compiler Collection. I recommend using the Command Line Tools for XCode, which can be installed from within XCode using the "Downloads" pane within "Preferences". Command Line Tools provide UNIX-style development via Terminal by installing command line developer tools (as well as MAC OS X SDK frameworks). Note that these can be installed without installing XCode here.
  • Homebrew: command line package manager for Mac OS X.