The setup
This is a short tutorial on how to compile R from source if you’ve never done it before.
If you have special requirements, the documentation might be more helpful.
To compile R from source from source you will need :
A working computer, phone (I do run R on my android phone with Termux), a watch or even a fridge. If it can run Linux, it can probably run R.
The dependencies. That’s the tricky part. It depends on your system. I will assume you got this sorted out already. But it’s ok if you don’t. At the
configure
step you will see what’s missing.A shell where you can execute the tar and make command. I would recommend also getting a fortran compiler such as gfortran.
The process
1) Getting the source code
Get the latest tar.gz on the cran website .
2) Extracting the source code from the tar ball
tar -xzvf {placeholder for your tar ball : R-x.y.z.tar.gz}
cd {R-x.y.z.tar.gz}
3) The configure script and the flags
To get the official list of flags :
./configure -help
TLDR
./configure --enable-prebuilt-html --with-x --enable-year2038 --enable-memory-profiling --enable-R-shlib --with-blas --with-lapack --with-readline --with-cairo
make
make check
You can also use make install
Notes
You can skip :
–with-x
If you’re building R for a server and you won’t need any graphics or if you’re building for a mac.
–with-cairo
Cairo is a graphic library you will probably need if you want transparent plots. Once again, for a server , it’s not mandatory.
–enable-prebuilt-html
If you don’t want separate html docs files. Once again, … , for a server …
Pay attention to :
-enable-year2038
It’s referring to a known problem with the way Unix systems store time.
Uninstalling R
From the source directory :
make uninstall