Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rbenv doesn't work on ubuntu with rbenv and ruby-build?

I just installed rbenv and ruby-build on my ubuntu server. This is ubntu version:

Description:  Ubuntu 14.04.1 LTS
Release:  14.04

And I installed rbenv 0.4.0

There are two problem with rbenv. First it doesn't show latest version of ruby when I type following command:

rbenv install -v The result would is this:

usage: rbenv install VERSION
       rbenv install /path/to/definition

Available versions:
  1.8.6-p383
  1.8.6-p420
  1.8.7-p249
  1.8.7-p302
  1.8.7-p334
  1.8.7-p352
  1.8.7-p357
  1.8.7-p358
  1.9.1-p378
  1.9.2-p180
  1.9.2-p290
  1.9.2-p318
  1.9.2-p320
  1.9.3-dev
  1.9.3-p0
  1.9.3-p125
  1.9.3-p194
  1.9.3-preview1
  1.9.3-rc1
  2.0.0-dev   jruby-1.6.3   jruby-1.6.4   jruby-1.6.5   jruby-1.6.5.1   jruby-1.6.6   jruby-1.6.7   jruby-1.6.7.2   jruby-1.7.0-preview1   maglev-1.0.0   rbx-1.2.4   rbx-2.0.0-dev   ree-1.8.6-2009.06   ree-1.8.7-2009.09   ree-1.8.7-2009.10   ree-1.8.7-2010.01   ree-1.8.7-2010.02   ree-1.8.7-2011.03   ree-1.8.7-2011.12   ree-1.8.7-2012.01   ree-1.8.7-2012.02

As you know the latest version is 2.2.2!

And beside every time I try this:

rbenv install 2.0.0-dev

The result is like this:

Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...

BUILD FAILED

Inspect or clean up the working tree at /tmp/ruby-build.20150125192327.14980
Results logged to /tmp/ruby-build.20150125192327.14980.log

Last 10 log lines:
make[2]: Entering directory `/tmp/ruby-build.20150125192327.14980/yaml-0.1.4/include'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/home/amirabbas/.rbenv/versions/2.0.0-dev/include" || /bin/mkdir -p "/home/amirabbas/.rbenv/versions/2.0.0-dev/include"
 /usr/bin/install -c -m 644  yaml.h '/home/amirabbas/.rbenv/versions/2.0.0-dev/include/.'
/usr/bin/install: cannot remove ‘/home/amirabbas/.rbenv/versions/2.0.0-dev/include/./yaml.h’: Permission denied
make[2]: *** [install-nobase_includeHEADERS] Error 1
make[2]: Leaving directory `/tmp/ruby-build.20150125192327.14980/yaml-0.1.4/include'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/tmp/ruby-build.20150125192327.14980/yaml-0.1.4/include'
make: *** [install-recursive] Error 1
like image 497
aakpro Avatar asked Mar 17 '23 06:03

aakpro


2 Answers

Regarding Ruby versions you have to update ruby-build gem:

cd ~/.rbenv/plugins/ruby-build/
git pull

then you will have 2.2 version.

Ruby has some native dependencies so you have to install them before installing Ruby:

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties

Source: https://gorails.com/setup/ubuntu/14.10

like image 153
Иван Бишевац Avatar answered Mar 19 '23 18:03

Иван Бишевац


You need to update ruby-build to have available to install all new versions. Go to:

cd ~/.rbenv/plugins/ruby-build/

Then update:

git pull

After update, restart your terminal and run rbenv install -l to list all the available versions to install (for me, the last is 2.3.0-dev)

like image 28
Alfonso Avatar answered Mar 19 '23 19:03

Alfonso