Installing R¶
This page describes quick OS-specific steps to install R. If you are not familiar with installing software, you can consult this point-to-point guide.
- Download and run the CRAN installer for Windows
- Install Rtools (required for packages that compile native code)
- Choose the Rtools version that matches your R release.
- Make sure that R is added to your system path.
Verify installation:
R --version
Rscript -e "install.packages('jsonlite', repos='https://cloud.r-project.org'); cat('ok\n')"
If R is not found, R is most likely missing in your system variables. Open environmental variables and add the path to your R executable. R is most likely install at C:\Program Files\R\R-VERSION\bin\x64.
- Download and run the CRAN package for macOS
- Alternatively install via Homebrew:
brew install --cask rand optionallybrew install r
- Alternatively install via Homebrew:
-
Install Xcode command line tools for compilers:
xcode-select --install
Verify installation:
R --version
Rscript -e "install.packages('jsonlite', repos='https://cloud.r-project.org'); cat('ok\n')"
-
Install R from the distribution repositories or CRAN (CRAN often provides newer versions). Example (Debian/Ubuntu):
sudo apt-get update sudo apt-get install r-base r-base-dev -
Install build tools and Fortran for compiling packages:
sudo apt-get install build-essential gfortran libblas-dev liblapack-dev
Verify installation:
R --version
Rscript -e "install.packages('jsonlite', repos='https://cloud.r-project.org'); cat('ok\n')"
Troubleshooting¶
- If compilation fails, ensure Rtools is installed and added to your PATH.
- Ensure Xcode command line tools are installed.
- Ensure
build-essentialandgfortranare installed.