R: error installing R package devtools on Linux

As I attempted to install the R package “devtools” on my Ubuntu 14.04 laptop I encountered an error as follows:


> install.packages("devtools")
Installing package into ‘/home/tfox/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
also installing the dependencies ‘mime’, ‘bitops’, ‘brew’, ‘httr’, ‘RCurl’, ‘memoise’, ‘whisker’, ‘evaluate’, ‘rstudioapi’, ‘jsonlite’, ‘roxygen2’

... SNIP ...

* installing *source* package ‘RCurl’ ...
** package ‘RCurl’ successfully unpacked and MD5 sums checked
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/tfox/R/x86_64-pc-linux-gnu-library/3.2/RCurl’
Warning in install.packages :
installation of package ‘RCurl’ had non-zero exit status

ERROR: dependency ‘RCurl’ is not available for package ‘httr’
* removing ‘/home/tfox/R/x86_64-pc-linux-gnu-library/3.2/httr’
Warning in install.packages :
installation of package ‘httr’ had non-zero exit status
ERROR: dependencies ‘httr’, ‘RCurl’ are not available for package ‘devtools’
* removing ‘/home/tfox/R/x86_64-pc-linux-gnu-library/3.2/devtools’
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status

Oops, the error indicates we have an OS dependency on a shared library
which we don’t have. Noticing this we need the development version
of libcurl. Let’s install it and try again.

For Ubuntu / Mint / Debian:


sudo apt-get install libcurl4-gnutls-dev

For CentOS / Fedora / RHEL:


$ sudo yum -y install libcurl libcurl-devel

Once we install this, we can re-install devtools and it
installs fine.

2 thoughts on “R: error installing R package devtools on Linux”

  1. Hi,

    I am facing the same problem while installing devtools on Ubuntu 14.04. I have upgraded R version to 3.3.2. Even after running the command sudo apt-get install libcurl4-gnutls-dev I am not able to install the package. What might be the problem? I am pasting code after running install.packages(“devtools”) command from R console. It is as follows (last part of it):
    installing to /home/delphi-ubuntu/R/x86_64-pc-linux-gnu-library/3.3/git2r/libs
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    * DONE (git2r)
    * installing *source* package ‘withr’ …
    ** package ‘withr’ successfully unpacked and MD5 sums checked
    ** R
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    * DONE (withr)
    ERROR: dependency ‘R6’ is not available for package ‘httr’
    * removing ‘/home/delphi-ubuntu/R/x86_64-pc-linux-gnu-library/3.3/httr’
    * installing *source* package ‘memoise’ …
    ** package ‘memoise’ successfully unpacked and MD5 sums checked
    ** R
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    * DONE (memoise)
    ERROR: dependency ‘httr’ is not available for package ‘devtools’
    * removing ‘/home/delphi-ubuntu/R/x86_64-pc-linux-gnu-library/3.3/devtools’

    The downloaded source packages are in
    ‘/tmp/RtmpW9Sbyx/downloaded_packages’
    Warning messages:
    1: In install.packages(“devtools”) :
    installation of package ‘httr’ had non-zero exit status
    2: In install.packages(“devtools”) :
    installation of package ‘devtools’ had non-zero exit status

    I will appreciate your help.

Leave a Reply

Your email address will not be published. Required fields are marked *