Error Installing Ruby 2.2.2 via rbenv

I’m getting the following when trying to install ruby via rbenv. I’m new to openSUSE and Linux so my knowledge is limited. I’ve been reading and learning a lot along the way though. I’m trying to install jekyll and wanted to update ruby because I don’t have the development headers needed for the Jekyll install. I couldn’t find the repo(?) for it either in YasT so I figured I would update ruby. I’ve been following the instructions on this page from the openSUSE Wiki.

moorebrb@linux-ifev:~> rbenv install 2.2.2
Downloading ruby-2.2.2.tar.gz...
Installing ruby-2.2.2...
BUILD FAILED (openSUSE project 13.2 using ruby-build 20150803)                               
Inspect or clean up the working tree at /tmp/ruby-build.20150810142531.3892                  
Results logged to /tmp/ruby-build.20150810142531.3892.log                                    
Last 10 log lines:                                                                           
installing rdoc:              /home/moorebrb/.rbenv/versions/2.2.2/share/ri/2.2.0/system     
installing capi-docs:         /home/moorebrb/.rbenv/versions/2.2.2/share/doc/ruby
The Ruby readline extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:

The above error is from trying to install Ruby 2.2.2 via rbenv.
The error below is from trying to install Jekyll.

moorebrb@linux-ifev:~/.rbenv/plugins/ruby-build> sudo gem install jekyll
root's password:
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby.ruby2.1 -r ./siteconf20150810-32549-g8jc4i.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib64/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /usr/lib64/ruby/gems/2.1.0/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /usr/lib64/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/fast-stemmer-1.0.2/gem_make.out

Should I leave the ruby update alone and just try to figure out how to install the header files for Ruby instead? Should I try to update to 2.2.2 and will the new update install the header files for me? I’ve been doing a lot of reading and searching and I didn’t really know where to look for answers so I was hoping someone could point me in the right direction or shed some light on what I’m doing wrong.

Thanks for the help and for reading!

Yast is now built on ruby changing versions could hurt lots of things. I believe that other versions can be installed in parallel and you can switch to those when you need.

At the time my wiki article was written, I configured Ruby 2.2.2 to be applied globally and found after fairly extensive testing (which still admittedly might not be perfect) that all YAST still works fine.

But, if running Ruby 2.2.2 globally is an uncomfortable risk, that is what rbenv is for… You can specify that any Ruby downloaded by rbenv be applied only to a specific directory tree containing your Ruby app, and leave the rest of the system running the default Ruby.

Typically build failures are due to missing prerequisites. The following is from the wiki

You first need to install a few apps from the openSUSE special Ruby repo, so add it

zypper ar devel:languages:ruby:extensions && zypper ref

Now install the prerequisites. Up to where I listed “git” are absolutely required. The other packages are typically already on your system or only necessary for Ruby on Rails (or similar) but if you’re uncertain, install them all. I’m wondering if you’re currently missing gcc and make. Note that on a Tumbleweed system , I recommend downgrading to the “normal” gcc. If on TW, zypper will prompt you for options to do so.

zypper in ruby rubygem-bundler nodejs git    gcc make libopenssl-devel sqlite3-devel

Note that in my wiki, if you don’t have a Ruby installed successfully using rbenv and are then using a Ruby installed from the openSUSE repos, I do not recommend using the “gem” command to download Ruby packages from the official Ruby repos. Instead, I recommend you install gems whch have been re-packaged and are also in the openSUSE repos, you can list available packages with the following

zypper se gem