Example: How to install a package for R on Mac OS X 10.5 Leopard

Assuming that you already have the R statistics program installed on your Mac, the following can be used to install a package from the command line.

First, get the .tgz file (we'll use plotrix as the package we want to install):

$ curl http://cran.r-project.org/bin/macosx/universal/contrib/r-release/plotrix_2.6-1.tgz > plotrix_2.6-1.tgz

Check that R is properly installed:

$ which R
/usr/bin/R

Install the package:

$ sudo R CMD INSTALL plotrix_2.6-1.tgz
Password:
* Installing to library '/Library/Frameworks/R.framework/Resources/library'
* Installing *binary* package 'plotrix' ...
* DONE (plotrix)

Check that everything is happy:

$ ls -l /Library/Frameworks/R.framework/Resources/library/
total 8
drwxrwxr-x 16 root admin 544 Jun 26 09:59 KernSmooth
drwxrwxr-x 20 root admin 680 Jun 26 09:59 MASS
drwxrwxr-x 22 root admin 748 Jun 26 09:59 Matrix
-rw-rw-r-- 1 root admin 866 Jun 26 10:00 R.css
drwxrwxr-x 15 root admin 510 Jun 26 09:59 base
drwxrwxr-x 16 root admin 544 Jun 26 09:59 boot
drwxrwxr-x 18 root admin 612 Jun 26 09:59 class
drwxrwxr-x 16 root admin 544 Jun 26 09:59 cluster
drwxrwxr-x 13 root admin 442 Jun 26 09:59 codetools
drwxrwxr-x 13 root admin 442 Jun 26 09:59 datasets
drwxrwxr-x 18 root admin 612 Jun 26 09:59 foreign
drwxrwxr-x 17 root admin 578 Jun 26 09:59 grDevices
drwxrwxr-x 15 root admin 510 Jun 26 09:59 graphics
drwxrwxr-x 16 root admin 544 Jun 26 09:59 grid
drwxrwxr-x 19 root admin 646 Jun 26 09:59 lattice
drwxrwxr-x 15 root admin 510 Jun 26 10:00 methods
drwxrwxr-x 15 root admin 510 Jun 26 09:59 mgcv
drwxrwxr-x 21 root admin 714 Jun 26 09:59 nlme
drwxrwxr-x 18 root admin 612 Jun 26 09:59 nnet
drwxr-xr-x 15 root admin 510 Jul 7 14:30 plotrix
drwxrwxr-x 17 root admin 578 Jun 26 09:59 rpart
drwxrwxr-x 20 root admin 680 Jun 26 09:59 spatial
drwxrwxr-x 15 root admin 510 Jun 26 09:59 splines
drwxrwxr-x 18 root admin 612 Jun 26 09:59 stats
drwxrwxr-x 14 root admin 476 Jun 26 09:59 stats4
drwxrwxr-x 16 root admin 544 Jun 26 09:59 survival
drwxrwxr-x 17 root admin 578 Jun 26 09:59 tcltk
drwxrwxr-x 15 root admin 510 Jun 26 09:59 tools
drwxrwxr-x 17 root admin 578 Jun 26 09:59 utils

Sure enough, plotrix is there nestled among the other packages.

[ Submitted by John on Tue, 2009-07-07 14:20. | | ]

Hi John, I'm having problems

Hi John,

I'm having problems trying to install Rcapture into R on a Mac OS X 10.5 Leopard. I tried following your post but the email address doesnt seem to work any longer.

Any pointers would be gratefully received.

Cheers

Vic

[ Submitted by Vic (not verified) on Thu, 2010-01-21 12:22. | ]

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question tests your humanity.