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.