NOTE: See Windows installation instructions for more detail.
It may be necessary to do the following steps with an “Administrator” account.
To install R, visit the Windows base distribution page. Click on the
Download R-3.3.2 for Windows link. Click on the installer and make the default selection for each option.
To install RStudio, visit the RStudio download page. Click on the
RStudio 1.0.136 - Windows Vista/7/8/10 link. Click on the installer and follow default instructions.
Be sure to switch back to your regular account before starting to use the software that you have just installed.
NOTE: See R for Mac OS X for more detail.
To install R, visit the R for Mac OS X. Click on the the
R-3.3.2.pkg link. Click on the installer and follow default instructions.
To install RStudio, visit the RStudio download page. Click on the
RStudio 1.0.136 - Mac OS X 10.6+ (64-bit) link. Click on the installer and follow default instructions.
NOTE: See distribution-specific instructions for additional detail.
On debian-based systems, the easiest way to install R is through a package manager manager, run under an administrator account. On Linux one usually needs to install R packages from source, and R package source often contains C, C++, or Fortran code requiring a compiler and
-dev versions of various system libraries. It is therefore convenient to install the
-dev version of R.
sudo apt-get install r-base r-base-dev
When installing source packages, it may be necessary to have access to the
-dev version of various system libraries. Many of these are installed as dependencies of
r-base-dev; other common examples include the xml and curl libraries
sudo apt-get install libxml2-dev sudo apt-get install libcurl-dev
Note in particular the use specification of libraries (the
lib prefix) and the use of the
To install RStudio, visit the RStudio download page. Download the appropriate archive by clicking on the
RStudio 1.0.136 - link for your OS. On Ubuntu, install the
.deb installer with
sudo dpkg -i rstudio-1.0.136-amd64.deb
Advanced installation is required to (a) install custom packages that (b) have their own C, C++, or Fortran code. In all other cases, the easy installation is sufficient.
Advanced installation requires
Rtools34.exe, available the Rtools web site. Download and click on the installer. Answer all installer questions with default values. The two most tricky parts are:
Make sure you have Xcode and Xcode command line tools installed on your mac. If not, you can run the following command on your terminal application to install Code
For command line tools, go to http://developer.apple.com/downloads and sign in with your Apple ID (the same one you use for iTunes and app purchases). Look for ‘Command line tools’ through the search box, download the required file and install via the
.dmg file on your machine.
For more detailed instructions on this, please visit this link.
Open your terminal application on your mac. Follow the steps below:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update && brew doctor
# Brew taps and requirements brew tap caskroom/cask brew tap homebrew/science brew install caskroom/cask/brew-cask
# Dependencies brew cask install xquartz brew cask install java
# Install R with X11 brew install --with-x11 r # Install RStudio brew cask install --appdir=/Applications rstudio
Note: the inclusion of the
--appdir option. By default, Cask formula’s will create aliases in
~/Applications, but this option tells Homebrew to use
LaTeXon your machine as well.
# For latex: brew cask install mactex brew install libsvg curl libxml2 gdal geos boost R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
This step is not recommended for new users and it would be much easier installing R using homebrew.
We assume that the users have the following software installed,
liblzmais not installed on your machine, you can follow the steps below. These steps help you install binaries of these programs without having to compile them from scratch.
One thing to keep in mind is the version of OSX being run, i.e take note of the binaries you download from http://r.research.att.com/libs/. Most people should be having OS-X Snow leopard or higher.
|darwin_id||Mac OS version|
|darwin8||for Mac OS X 10.4 (Tiger) or higher|
|darwin89||32-bit for Mac OS X 10.4 or higher, 64-bit for Mac OS X 10.5 or higher|
|darwin9||for Mac OS X 10.5 (Leopard) or higher|
|darwin10||for Mac OS X 10.6 (Snow Leopard) or higher|
|darwin13||for Mac OS X 10.9 (Mavericks) or higher|
# This is for mac OS sierra ## Gfortran curl -O 'http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2' sudo tar fxvz gfortran-4.8.2-darwin13.tar.bz2 -C / ## XZ library or liblzma curl -O 'http://r.research.att.com/libs/xz-5.2.1-darwin.13-x86_64.tar.gz' sudo tar fvxz xz-5.2.1-darwin.13-x86_64.tar.gz -C / ## pcre curl -O 'http://r.research.att.com/libs/pcre-8.36-darwin.13-x86_64.tar.gz' sudo tar fvxz pcre-8.36-darwin.13-x86_64.tar.gz -C /
# I'm making a new directory in my home called "R-stuff" mkdir ~/R-stuff # SVN checkouto R-devel or a specific version of R. The rest of this document # will show the workflow for devel version of R. But the steps are the same for # the release version as well. svn checkout https://svn.r-project.org/R/trunk/ ~/R-stuff/devel # or both. (if you want to have devel and release versions of R on your machine) svn checkout https://svn.r-project.org/R/branches/R-3-3-branch/ ~/R-stuff/release-3-3
devel or release-3-3directory.
# Download recommmended packages ./tools/rsync-recommended
# make a new directory to configure R mkdir -p ~/R-stuff/bin/R-devel cd ~/R-stuff/bin/R-devel ~/R-stuff/devel/configure --enable-R-shlib --enable-R-profiling --enable-memory-profiling --with-internal-tzcode=no
# run make make # Then check the built system works correctly by make check
Once R-studio is installed, and you have manually compiled R, you have to create an alias for your R-studio in your .bashrc or whatever shell you are using on your machine.
The alias will look like,
# R release version; i.e latest release branch, use absolute paths # when making aliases. This makes it accessible by just using R in the # terminal. alias R="/Users/hansolo/R-stuff/bin/R-devel/bin/R" # This tells Rstudio which R to use as default export RSTUDIO_WHICH_R=/Users/hansolo/R-stuff/bin/R-devel/bin/R;
.bashrc you can have something like:
# R release/patched version; i.e latest release branch alias R-release="/Users/hansolo/R-stuff/bin/R-3-3-branch/bin/R" alias RStudio-release="export RSTUDIO_WHICH_R=/Users/hansolo/R-stuff/bin/R-3-3-branch/bin/R; open -a RStudio" # R devel setup alias R-dev="/Users/hansolo/R-stuff/bin/R-devel/bin/R" alias RStudio-dev="export RSTUDIO_WHICH_R=/Users/hansolo/R-Stuff/bin/R-devel/bin/R; open -a RStudio"
Now you can call your R-release version using the command
R-release and if you use the command
RStudio-release , Rstudio will use the release version of R. Same goes with the commands
Try out the installation in a new terminal or after sourcing your
You should be all set and ready to use R!
For advanced Linux installation, a typical approach is ‘checkout’ the R source code from its SVN version control repository and retrieve recommended packages.
mkdir ~/src cd ~/src svn checkout https://svn.r-project.org/R/branches/R-3-3-branch tools/rsync-recommended
The next step is to configure the software, typically in an indepenent ‘bin’ directory
mkdir ~/bin cd ~/bin/R-3-3-branch ~/src/R-3-3-branch/configure
There are a number of configure options, see
~/src/R-3-3-branch/configure. Typical problems during configuration involve missing system libraries; the
-dev versions of these libraries need to be installed by a system administrator.
The final step is to build the software
cd ~/bin/R-3-3-branch make -j
The executable is at
~/bin/R-3-3-branch/bin/R; it is convenient to add
~/bin/R-3-3-branch/bin to the system
PATH variable or to create a shell alias pointing to the executable. A system-wide installation can be made available with
sudo make install