I tried to install ruby2.3 on Ubuntu 20.04. sudo apt install ruby2.3 failed as it is unable to locate package ruby2.3. I then tried installing via snap:
$ sudo snap install ruby --classic $ sudo snap switch ruby --channel=2.3/stable $ sudo snap refresh Then I tried to install fpm:
$ gem install fpm Fetching: stud-0.0.23.gem (100%) Successfully installed stud-0.0.23 Fetching: cabin-0.9.0.gem (100%) Successfully installed cabin-0.9.0 Fetching: clamp-1.0.1.gem (100%) Successfully installed clamp-1.0.1 Fetching: mustache-0.99.8.gem (100%) Successfully installed mustache-0.99.8 Fetching: insist-1.0.0.gem (100%) Successfully installed insist-1.0.0 Fetching: dotenv-2.7.6.gem (100%) Successfully installed dotenv-2.7.6 Fetching: pleaserun-0.0.31.gem (100%) Successfully installed pleaserun-0.0.31 Fetching: io-like-0.3.1.gem (100%) Successfully installed io-like-0.3.1 Fetching: ffi-1.13.1.gem (100%) Building native extensions. This could take a while... ERROR: Error installing fpm: ERROR: Failed to build gem native extension. current directory: /home/t/.gem/gems/ffi-1.13.1/ext/ffi_c /snap/bin/ruby -r ./siteconf20200928-71416-wr10i1.rb extconf.rb mkmf.rb can't find header files for ruby at /snap/ruby/109/lib/ruby/include/ruby.h extconf failed, exit code 1 Gem files will remain installed in /home/t/.gem/gems/ffi-1.13.1 for inspection. Results logged to /home/t/.gem/extensions/x86_64-linux/2.3.0-static/ffi-1.13.1/gem_make.out Other solutions seem to suggest installing ruby-dev, but ruby2.3-dev is not available, nor is ruby2.3.8-dev.
1 Answer
Use command
sudo apt-get install ruby-dev build-essential && sudo gem i fpm -f do not install ruby by snap. In my case it works:
fpm --version 1.12.0 Full article about fpm on ubuntu: