Installing R-devel on Linux (Ubuntu/Mint)

This post has been updated:

  • 1. July 2016: Updates thanks to comment of Frederik Eaton
  • 2. April 2016: Included downloading and building recommended package (I couldn’t check packages requiring recommended packages without that).
  • 29. March 2016: Updated script as it stopped working (Thanks to Matt Flor for noticing that).


Before submitting an R package to CRAN the CRAN policies demand a package runs R CMD check --as-cran without any warnings or notes. More specifically, the policies demand that “[t]his should be done with the current version of R-devel”.  Previously I have done this on Windows, but even with the latest R-devel there are always issues that just do not pop up there (e.g., checking of URLs). Consequently, I have recently (finally) switched to Linux. But as a total Linux noob setting up R-devel was not trivial. This post shows how to set up R-devel next to the latest regular R and how to use it to test packages.

To install R-devel you first need to make sure you are able to install R and R-packages. Please follow the instructions here:

Then you will also need subversion (for getting the latest source) and I also needed to install xorg (in case you get some unexpected errors it may be necessary to also install the suggestions given here):

sudo apt-get install subversion ccache
sudo apt-get install xorg-dev

Now you need to get a current version of the source code via svn (i.e., subversion). For this, first create a folder svn in your home directory, change to this directory, and then checkout the latest version of the source code.

cd ~
mkdir svn
cd svn
svn co r-devel/R

You also need to download and link the recommended packages for using them in R CMD check as described in the R installation manual (this needs to happen in the correct folder).

cd r-devel/R/
bash ./tools/rsync-recommended
bash ./tools/link-recommended

Following a comment from Martin Maechler we do not build R in the svn directory, but rather in a newly created build directory:

mkdir ~/svn/R-devel-build

Next you need to build R-devel, preferably in a different location then your usual R installation. We do this with a script courtesy of Dirk Eddelbuettel (which I changed so it uses the correct path and --with-recommended-packages). Simply create a new file build-R-devel with the following content. It makes a lot of sense to put this file in a location that is in the $PATH, I recommend /usr/local/bin (which requires root/sudo). At the end of this, we automatically run make install which we also add to the script (which is in contrast to the recommendations of Martin Macheler from above, but it works just fine).

## ~/bin/build-R-devel


cd ~/svn/R-devel-build

# R_PAPERSIZE=letter                \
# R_BATCHSAVE="--no-save --no-restore"         \
# R_BROWSER=xdg-open                \
# PAGER=/usr/bin/pager                \
# PERL=/usr/bin/perl                \
# R_UNZIPCMD=/usr/bin/unzip            \
# R_ZIPCMD=/usr/bin/zip                \
# R_PRINTCMD=/usr/bin/lpr                \
# LIBnn=lib                    \
# AWK=/usr/bin/awk                                \
# CC="ccache gcc"                    \
# CFLAGS="-ggdb -pipe -std=gnu99 -Wall -pedantic -DTESTING_WRITE_BARRIER" \
# CXX="ccache g++"                \
# CXXFLAGS="-ggdb -std=c++0x -pipe -Wall -pedantic" \
# FC="ccache gfortran"                \
# FCFLAGS="-ggdb -pipe -Wall -pedantic"        \
# F77="ccache gfortran"                \
# FFLAGS="-ggdb -pipe -Wall -pedantic"        \
# MAKE="make -j4"                    \
# ./configure                     \
#     --prefix=/usr/local/lib/R-devel         \
#     --enable-R-shlib                 \
#     --enable-strict-barrier             \
#     --with-blas                 \
#     --with-lapack                 \
#     --with-readline                 \
#     --with-recommended-packages

R_PAPERSIZE=letter                \
R_BATCHSAVE="--no-save --no-restore"         \
R_BROWSER=xdg-open                \
PAGER=/usr/bin/pager                \
PERL=/usr/bin/perl                \
R_UNZIPCMD=/usr/bin/unzip            \
R_ZIPCMD=/usr/bin/zip                \
R_PRINTCMD=/usr/bin/lpr                \
LIBnn=lib                    \
AWK=/usr/bin/awk                                \
CC="ccache gcc"                    \
CFLAGS="-ggdb -pipe -std=gnu99 -Wall -pedantic" \
CXX="ccache g++"                \
CXXFLAGS="-ggdb -pipe -Wall -pedantic"         \
FC="ccache gfortran"                   \
F77="ccache gfortran"                \
MAKE="make -j4"                    \
../r-devel/R/configure                     \
    --prefix=/usr/local/lib/R-devel         \
    --enable-R-shlib                 \
    --with-blas                 \
    --with-lapack                 \
    --with-readline                 \

#CC="clang -O3"                                  \
#CXX="clang++ -03"                \

#make svnonly

echo "*** Done -- now run 'make install'"

make install

echo "*** All Done -- start R-devel with 'bash R-devel'"

Next, you need to install R-devel using this script which automatically changes to the correct directory. Note that this step requires sudo.

sudo bash build-R-devel

Now we only need a custom run script to actually run R-devel. Again this script is based on one written by Dirk Eddelbuettel and it should also be in a folder which is in the path such as /usr/local/bin (I have updated this script based on the comments below).

## ~/bin/


export R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R-devel/lib/R/library:/usr/local/lib/R/site-library:/usr/lib/R/site-library'}
export PATH="/usr/local/lib/R-devel/bin:$PATH"
R "$@"

To finally run R-devel simply call it as a script: bash R-devel
It should show you that it is the current development version: R Under development (unstable) (CURRENT DATE)
As this is a vanilla version of R, you will have to install all the packages you need.

The R-devel script can also be used to build or check your package:

bash R-devel CMD build your-package-directory
bash R-devel CMD check --as-cran your-package.tar.gz

Once all this is set up, the steps of updating your R-devel installation to the latest version only involves calling the scripts in the right order:

cd ~/svn/r-devel/R
svn update
bash ./tools/rsync-recommended
bash ./tools/link-recommended
sudo bash build-R-devel

After doing so, it is probably a good idea to update the packages:

bash R-devel

I have used the following sources to compile this post:



  • Thanks for that fantastic guide! That went very smoothly.

    However, I encountered a weird error when installing packages. Some went fine, others threw a object 'checkCompilerOptions' not found error, like here:

    So, to anyone also seeing this: I finally managed to solve the issue after reading
    All I had to do was removing the /usr/lib/R/library path in


    export R_LIBS_SITE=${R_LIBS_SITE-‘/usr/lib/R-devel/lib/R/library:/usr/local/lib/R/site-library:/usr/lib/R/site-library’}
    export PATH=”/usr/local/lib/R-devel/bin:$PATH”
    R “$@”

    Matt Flor2016-03-21
  • Matt, thanks for your comment. I also needed to make this change to get it to work now. I have updated the guide accordingly.

    Henrik Singmann2016-03-29
  • Thanks for this manual! It all worked pretty well

  • Interesting post, thank you!

    you configure –without-recommended-packages, but you first do ./tools/rsync-recommended, why?
    you configure with –prefix=/usr/local/lib/R-devel, but the script to run R points to /usr/lib/R-devel, why?
    Martin Maechler suggested using a “build directory”, see

    Frederick Eaton2016-05-24
    • Hi Frederik,
      Thanks a lot for your comments. I have finally found the time to update the guide accordingly. I also have removed the step to call make install separately and added it to the script.
      Thanks and let me know if you see other problems.

      Henrik Singmann2016-07-01
  • Hi Henrik,

    the rsync stage does not wor on my ubuntu 16.04 distribution. I did the command
    bash ./tools/rsync-recommended

    There is the shell output:
    rsync: failed to connect to ( No route to host (113)
    rsync error: error in socket IO (code 10) at clientserver.c(128) [Receiver=3.1.1]
    *** rsync failed to update Recommended files ***

    Etienne Borocco2016-10-19
    • The error message suggests it is actually a problem with your internet connection. Perhaps it was temporary down or the SVN server unavailable. It still works on my machine.

      Henrik Singmann2016-10-22
  • On the r-help ML, I was told there were issues with the Vienna servers. However, I still got the same output. Can it be a firewall? I am connecting from my university.

    Etienne Borocco2016-10-24
  • Hi Henrik,

    Thank you so much for this tutorial. Here are some issues that I got and how I solved them. It might not be the optimal solution but it worked. I am on ubuntu 14.04 LTS.

    I) Problem of ‘connection time out’ when doing bash ./tools/rsync-recommended

    I have executed these commands instead:

    bash -x ./tools/rsync-recommended
    I took the the version info on the ‘rsync’ line which should output at the end.
    I did: wget -r -l1 –no-parent -A*.gz -nd -P src/library/Recommended

    II) sudo bash build-R-devel: got error ‘/usr/bin/install: cannot stat ‘NEWS.pdf’: No such file or directory’

    going to ~/svn/R-devel-build and typing ‘sudo make’
    got error message: ‘pdflatex’ is needed to make vignettes but is missing on your system.’

    do: ‘sudo apt-get install texlive-latex-base’
    do: ‘sudo apt-get install texlive-latex-extra’
    do: ‘sudo apt-get install texlive-fonts-extra’
    do: ‘sudo apt-get build-dep r-base’
    do: sudo make
    do: sudo make install

    bash R-devel worked.

    Hope this can help.

    (PS: Did you use an online solution to build your website? thanks)

    Nicolas Descostes2017-09-06
    • Hi Nicolas,

      Thanks for your comment. Regarding (I), I haven’t yet encountered this. Good to know there is a solution. Regarding (II), I should probably add texlive to the requirements. Thanks for catching that.

      My website is a simple wordpress website on a commercial server running the pitch premium theme from Site Origin (which is not available any more).

      Henrik Singmann2017-09-07

Leave a Reply (Markdown is enabled)