Is R on Mac portable?

I'm not as familiar with the R installation on Mac. Is the installation portable? (ie can the contents of the R folder in "Applications" be transferred to another computer and not have issues?)

Unfortunately it seems like it might not be, but I would love to hear if there might a workaround to try.
If you update your macOS version, you should re-install R (and perhaps XQuartz): the installer may tailor the installation to the current version of the OS.
https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Installing-R-under-macOS

It's not just the R app in the applications folder; there are other bits and pieces scattered about, including the packages needed to actually do anything in R.

It's theoretically possible to track these all down and copy them over and fix the permissions, etc., etc., but a fresh install is far quicker and more reliable.

1 Like

Thanks. I'm not worried about the packages. I'm more curious whether the installer is checking/installing any additional libraries or how many "bits and pieces" are scattered around.

Reading the uninstallation section of the Installation and Administration Guide (same as you linked above, but a couple sections further along) might clarify things a bit more:
https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Uninstalling-under-macOS

Is there a specific problem you’re trying to solve by wanting to transfer an R installation rather than running the installer?

FWIW, you can also install R via a homebrew cask:
brew cask install r-app

(If you go that way, you might want to take a look at https://macos.rbind.io/ and https://github.com/r-hub/homebrew-cran, but now we’re really headed into the weeds… :nerd_face:)

2 Likes

Thanks, I haven't looked into homebrew enough, but it might work.

Specific problem:
This isn't what I'm doing, but how would one put R + R packages on a flash drive so that it works on Mac without local installation?

Are the contents of the below image (minus the multiple versions and things like Tcltk) sufficient?

Note: I've reached out to the people behind https://github.com/ColumbusCollaboratory/photon and how they implemented https://github.com/ColumbusCollaboratory/electron-quick-start/tree/master/R-Portable-Mac

You can start with the default installation of R on the Mac, and copying the folder.
/Library/Frameworks/R.framework/Resources/

Then work with the bash script ./bin/R for properly setting R_HOME and the libPaths.

What inspired us first was R-Portable for Windows which is more complicated than doing it on Mac; it has to be compiled from source; luckily William Huber took care of that heavy lifting for us. https://sourceforge.net/projects/rportable/

Would love for someone to contribute a linux version; should be pretty straight forward with a copy of the directory. But, we haven't yet tried it.

2 Likes

Awesome! And it looks like those are just environmental variables... are they carried into the R session? If you don't know I can check later.

Also, the Windows binary should be fine, actually seems easier than Mac which is weird -> it looks like R's location becomes hardcoded for Mac but not in Windows?

Taking a look into this now, this is mostly me leaving breadcrumbs to find later...

Paths are also described in Makeconf (and actually multiple files in etc), here:

Should think about packaging up things that aren't included but sometimes used by R (TCLTK) with R.

TCLTK_LIBS is in Makeconf, as is JAVA_HOME

potential issue:

# R was configured using the following call
# (not including env. vars and site configuration)
# configure  'CC=clang' 'CXX=clang++' 'OBJC=clang' 'CFLAGS=-Wall -g -O2' 'CPPFLAGS=-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include' 'CXXFLAGS=-Wall -g -O2' 'OBJCFLAGS=-Wall -g -O2' 'FCFLAGS=-Wall -g -O2' 'F77FLAGS=-Wall -g -O2' '--enable-memory-profiling' '--x-libraries=/opt/X11/lib' '--enable-R-framework' 'PKG_CONFIG_PATH=/usr/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/lib/pkgconfig'

Mac and probably linux installations hardcode paths which is annoying:
https://stat.ethz.ch/pipermail/r-devel/2009-October/055196.html

Also see:
https://stat.ethz.ch/pipermail/r-devel/2013-September/067544.html

https://superuser.com/questions/939070/a-self-contained-r-in-os-x?newreg=9908479451b448c69e0a8a7cfd793d45.

I think I got this:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.