[R-SIG-Mac] how to make a loaded distribution for courses?

Simon Urbanek simon.urbanek at r-project.org
Sat Mar 8 16:23:33 CET 2008

On Mar 8, 2008, at 6:55 AM, Vincent Carey 525-2265 wrote:

> I just taught a course based on R-2.7.0dev, where many bioconductor  
> and CRAN
> packages were required.  For the windows students, I take my
> loaded R-2.7.0dev folder, in which all needed packages have been  
> installed,
> zip it, and have them unzip it in some specified location so that
> there are no conflicts with existing installations.  A shortcut is set
> to the new Rgui.exe, given a name that distinguishes it from existing
> distributions, and this is used for the course.
> Can a similar process be conducted with a MacOSX distro?  The  
> desiderata
> are that a single decompression step yields an image of R with all
> desired packages, and a distinguishable icon is made available so that
> the course-specific GUI is selectable from doc or finder.

There are several ways to achieve this with various levels of  

1) Compile R with FW_VERSION=2.7-VC (or any other identifier),  
install, and compile the GUI. This guarantees a unique name that won't  
conflict with any other R installation.

2) Use R-devel from CRAN. This is easier as 1) since you don't need to  
compile anything, but by definition it will conflict with any other R- 
devel CRAN framework (or 2.7.x to be precise).

3) Use any binary and use install_name_tool to relocate it. All  
installed frameworks are linked with full paths to libraries.  
install_name_tool allows you to change those such that you can move  
the binaries anywhere.

4) Use non-framework version of R. Those are relocatable, but require  
a start script to set DYLD_LIBRARY_PATH to $R_HOME/lib. Although this  
allows you essentially to create one "R" icon containing the entire R  
(which can be place anywhere, even run from an image), care must be  
taken when compiling the GUI since there is no framework. Also it may  
be necessary to set DYLD_LIBRARY_PATH in the GUI.

1) and 2) use the regular framework location (/Library/Framerworks/ 
R.framework) such that the version to use can be selected using  
RSwitch. Note that the GUI starts always the version it was compiled  
for regardless of the RSwitch setting. Therefore by removing the  
"R.framework/Versions/Current" link before packaging you can make sure  
that the existing version is not touched.

On a Mac, I'd recommend a bit different approach that makes it easier  
for you: just get the regular R-devel from CRAN (e.g. in the  
tar.gzipped form to not have to worry about Apple's Installer  
upgrading the existing R) and archive only the packages. You can  
unpack them anywhere, just set R_LIBS or .libPaths() to the correct  

I hope it helps. Let me know if you have questions about the details.


More information about the R-SIG-Mac mailing list