How to fix RcppGSL installation error gsl-config: Command not found

Problem:

While trying to install RcppGSL using

BiocManager::install("RcppGSL")

you see the following error message:

checking for gcc option to accept ISO C89... none needed
checking for gsl-config... no
configure: error: gsl-config not found, is GSL installed?
ERROR: configuration failed for package ‘RcppGSL’
* removing ‘/usr/local/lib/R/site-library/RcppGSL’

The downloaded source packages are in
        ‘/tmp/RtmpqSzFab/downloaded_packages’
Warning message:
In .inet_warning(msg) :
  installation of package ‘RcppGSL’ had non-zero exit status

Solution:

You need to install the libgsl2 development headers which include the gsl-config executable.

On Ubuntu, you can install it using

sudo apt -y install libgsl2-dev