giovedì 23 ottobre 2008

R Upgrade on Mac Os X 10.5.5 (Leopard)

To reinstall packages from an old version of R to a new one.
In the old version type:
tmp <- installed.packages()
installedpkgs <- as.vector(tmp[[,"Priority"]), 1])
save(installedpkgs, file="installed_old.rda")

Install the most recent version of R:
Download the most recent version of R from The Comprehensive R Archive Network (CRAN)
# To wipe the old R version
rm -rf /Library/Frameworks/R.framework /Applications/
rm -rf /Library/Receipts/R-*

Build from source new R version (see this FAQ).
From inside the decompressed R-?.?.? directory type:
# See Section 2.2 of RMacOSX FAQ for the flag description
./configure --with-blas='-framework vecLib' --enable-BLAS-shlib
sudo make install

Install BioConductor packages using the biocLite.R installation script.
In an R command window, type the following:

If you have other Bioconductor packages missing from the old installation:

tmp <- installed.packages() <- as.vector(tmp[[,"Priority"]), 1])
missing <- setdiff(installedpkgs,
for (i in 1:length(missing)) biocLite(missing[i])

Re-install the missing packages from CRAN:
tmp <- installed.packages() <- as.vector(tmp[[,"Priority"]), 1])
missing <- setdiff(installedpkgs,

If you use some package created by Henrik Bengtsson:

If you find your X11 broken after the installation procedure (it happens every time to me, at least on Leopard) install the XQuartz App from here.

Update: If you need to install a recent version of R on old hardware (Power PC G4) and OS (Mac OS X 10.4 here) this post can be useful.

18 commenti:

  1. Thanks! This is extremely helpful!

  2. Grazie mille, with such good daily tips I'll be back here tommorrow!

  3. Troppo gentile! The door is always open! ;-)

  4. Thanks, very useful indeed.. I also suggest to use chooseBioCmirror() after sourcing "biocLite.R".. depending on your location and the installed packages (Hs map size is around 800Mb) the upgrade running time can be drastically reduced.


  5. @JC Thanks for your contribution!

  6. Hi,

    Thanks for the post. When trying to install bioconductor packages using, I get the following error:
    Error in file(file, "r", encoding = encoding) :
    internet routines cannot be loaded
    In addition: Warning message:
    In file(file, "r", encoding = encoding) :
    unable to load shared object '/Library/Frameworks/R.framework/Resources/modules/x86_64/':
    dlopen(/Library/Frameworks/R.framework/Resources/modules/x86_64/, 6): Library not loaded: /Library/Frameworks/R.framework/Versions/2.13/Resources/lib/libR.dylib
    Referenced from: /Library/Frameworks/R.framework/Resources/modules/x86_64/
    Reason: Incompatible library version: requires version 2.13.0 or later, but libR.dylib provides version 2.12.0

    Any advice would be appreciated!

  7. It seems (not sure) that some component of the previous version (R.2.12.0) are still in place. I suggest to wipe completely the old version (as stated at the beginning of the post) and try again to install R from scratch. Remember that this procedure works (at least for me) on Mac OS X 10.5. I can't guarantee this will work on Mac OS X 10.6 or 10.7 as well.

  8. Thank you so much for this. So much easier than copying my entire suite of library files and moving them back into the new R directory...

  9. I like the sarcasm. I don' like so much comments suggesting alternative strategies without indicate the context in which you can apply them.
    The procedure you suggest works almost certainly between minor revisions: e.g., upgrade from R-2.14.0 to R-2.14.1. Nevertheless try to upgrade 'your way' from let's say R-2.9.0 to R-2.14.1! I think you'll have a surprise! My post is meant to explain an upgrade workflow which works FOR ME with the particular configuration (hardware/software) described. It seems to be useful to other people too and I'm glad for that! If anybody (maybe using his real name, nobody bites on this blog ;-) ) want to post a more general, reliable and fast pipeline I'll be more than happy to update the post.

  10. hi...Im student from Informatics engineering nice article,
    thanks for sharing :)

  11. I'm happy it is of some use to you! :-)

  12. Thank you, this is very helpful!

    I think though that if I go through the commands in the order that you write them, this one:

    for (i in 1:length(missing)) biocLite(missing[i])

    ... installs all the packages from biocLite. So running


    first might make more sense. I'm not sure, I haven't tried this.

    Anyway, updated R and all packages there -> happy. Many thanks!

  13. Dear Marianne, I'm glad this old post it is still useful to someone! Nowadays I completely switch to Linux and I don't have access to a Mac. In any case i think the install.packages() function is redundant: you can use directly biocLite to install CRAN as well as bioconductor packages.

  14. Paolo! It is Gareth the student of Luca. I just had to fix this and found your blog. Bioinformatics is a small world so I'm saying hello to people when I run into them on forums from now on!

  15. Hi Gareth! Thanks for visiting my blog! I hope you find something useful for you! See you soon in person! :-)

  16. Hi there Paolo, thanks for your useful post! I tried this in my OS X 10.7.5 Lion and it seems like it worked! Do you mind if I put your code in my own blog? (with some minor comments for my particular case).

    1. Feel free to use the code on your blog: just put a link to the original post.