I'm very new to linux, my only experience being using a computer that belonged to somebody else before, meaning that everything was already configured/downloaded and I had no problem doing my job on it, which envolves using some GIS tools and RStudio.

Turns out three days ago I received a new computer form my boss and I decided to maintain the tradition and install linux too. All my co-workers were using Mint 18.3, so I downloaded it and installed it. It turns out it wasn't as straight-forward as I thought.

After reading a bunch of forums and questions posted here, I managed to update my sources.list and insert a CRAN mirror for the download of the latest release of R (3.4.4). RStudio promptly recognized it. However, installing new packages is nearly impossible, as even "native" functionalities, such as import dataset are disabled because the packages couldn't be downloaded.

I tried opening R through the terminal and installing packages using the install.packages function, but the problem persisted. How can I fix my RStudio in order to install packages correctly?

Below there is a copy of the log (note that I specified the mirror manually):

> install.packages("Rcpp",repo="https://cloud.r-project.org/", type="source")
Installing package into ‘/home/iis/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/Rcpp_0.12.16.tar.gz'
Content type 'application/x-gzip' length 3763400 bytes (3.6 MB)
downloaded 3.6 MB

* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++  -I/usr/share/R/include -DNDEBUG -I../inst/include/     -fpic  -g -O2         -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time     -D_FORTIFY_SOURCE=2 -g  -c Date.cpp -o Date.o
/bin/bash: g++: command not found
/usr/lib/R/etc/Makeconf:168: recipe for target 'Date.o' failed
make: *** [Date.o] Error 127
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/home/iis/R/x86_64-pc-linux-gnu-library/3.4/Rcpp’
Warning in install.packages :
  installation of package ‘Rcpp’ had non-zero exit status

Again, since I'm very new to linux, I don't know really which information I should provide to better help you, but please keep in mind that everything is probably on a default/factory setting. If you need additional information I can provide you (given the proper instructions)


Before you begin, many of the R packages depend on the following development tools so go ahead and install them first with apt-get install:


You can install the R packages via Rstudio via Tools > Install Packages and they will work for R as well. Enter the names of the packages into the field separated by spaces or columns. Sometimes, you'll need Bioconductor to install the packages and you can find that information here:


To give you an overview:


That will set the package source URL for the packages and the script to download and install them.

biocLite(c("GenomicFeatures", "AnnotationDbi"))

Use that syntax with the package names enclosed in double quotes. It will then proceed with download and installation.

  • Hey Nasir, thank you so much for spending your time and giving me such a detailed answer, but unfortunately, those 3 "apt-get install xxxxxx-devel" returned "Unable to locate package". Fortunately, I managed to solve the problem by using sudo apt-get install r-base-dev, which apparently had the necessary tool to make it work. However, if you have some insight on why I was unable to locate those packages, feel free to contribute. Thank you again. – Eric Lino Apr 11 '18 at 18:29
  • That was an error on my part as I am used to working with RHEL and CentOS but it's different for you as your using Mint. I will edit that part in my answer. Were you able to install the R packages afterwards? – Nasir Riley Apr 11 '18 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.