[R-SIG-Mac] Installing Mac packages from a directory of .tgz files

Berend Hasselman bhh at xs4all.nl
Sat Jan 15 09:35:33 CET 2011


On 15-01-2011, at 07:39, Murray Jorgensen wrote:

> Well, still no responses, but I'm further along the trail. I decided that I must need that 'PACKAGES' file so I went back to CRAN and got it, and placed it in my /Applications/tgz12.1/ folder.
> 
> This time with 'Other Directory URL' as 'files:///Applications/tgz12.1/' I at least got the Package list populated in the 'Repository Version' column.
> 
> I selected all and clicked 'Install Selected' to no obvious result, although maybe I was too impatient. Then I tried again selecting only the first package 'abc' but still it seems without response.


First of all, if you are trying to install from a local repository there are specific and detailed requirements.
See page 21-22 of the R-admin.pdf manual under heading "Setting up a package repository".

Second, there is no need to place the .tgz files in a folder in /Applications.
Also highly undesirable since /Applications is for applications and a system folder.

I have never installed from downloaded files so I may be completely wrong.
I have tested my recipe by downloading foreach_1.3.0.tgz and doing as described below (except that I installed the stuff in my personal R library).

Place the  .tgz files (mac binary package files) in a directory in your user tree.
For example ~/Temp/R

Start R.app and set the above directory as the working directory (menu Misc, Change Working Directory or with setwd("~/Temp/R").

Then for informative purposes do list.files() to check if all went well. You should see a list of the files you placed in that directory.

Now enter .libPaths() to see in which slot the main R library is located 
(Look for "/Library/Frameworks/R.framework/Resources/library"; for me it's in slot 2).

Assume you want to install package foreach_1.3.0 (file foreach_1.3.0.tgz) then enter the following command in R.app

install.packages(pkgs=c("foreach_1.3.0.tgz"),lib=.libPaths()[2],repos=NULL)

Repeat for other packages ( you can also set pkgs=c("pkg1.tgz", "pkg2.tgz",...) )

good luck 

Berend



More information about the R-SIG-Mac mailing list