
Rbenv, an unobtrusive rvm replacement - vamsee
https://github.com/sstephenson/rbenv
======
chc
I'm having trouble imagining who this is for, at least in the context of an
RVM replacement. The point of RVM is convenience. It's like RVM, only without
most of the convenience (gemsets, installing standard versions and migrating
between versions, primarily). If I wanted to manually manage all my Rubies, I
wouldn't be using RVM. I like the sentiment of being less of a hack than RVM,
but I just don't see much use for this particular set of functions

~~~
sstephenson
The main use case is for specifying per-application Ruby version dependencies.
For example, at 37signals, most of our apps run on REE, but our new apps run
on 1.9.x, and we're gradually moving everything to 1.9. When you have multiple
people working on multiple apps every day, it's essential that this dependency
information is checked into version control. Even more so when certain
branches of an app may depend on different versions.

Both rvm and rbenv allow you to specify per-application dependencies (rvm with
.rvmrc files, rbenv with .rbenv-version files). The difference is that rbenv
does it in a much simpler, less invasive way.

------
sstephenson
An official release with a web site and improved installation process should
be out next week.

If you're wondering "why would I use this instead of rvm?" be sure to read the
readme: <https://github.com/sstephenson/rbenv#readme>

~~~
yariang
I looked at RVM a few weeks back while trying to set up a Rails app and was so
frustrated I went outside and kicked a kitty.

I am glad to see a project that should restore some of my sanity. Good work.

~~~
kaylarose
What was so frustrating about RVM?

~~~
yariang
I just could not get it to work. I follow several instruction pages carefully.
I was initially trying to follow:

[http://ruby.railstutorial.org/ruby-on-rails-tutorial-
book#se...](http://ruby.railstutorial.org/ruby-on-rails-tutorial-
book#sec:install_ruby)

I kept getting issues with versions.

I should have specified that, I do not necessarily think it is a bad product,
but it did frustrate me a lot when trying to set it up. I'm sure it has saved
a lot of developers time, but I speak for myself and myself alone, and the
cost-benefit for me was way off.

------
cwjohnston
Looks interesting. It's always been pretty amazing to me that a system like
RVM remains so popular when it depends on overriding the operation of basic
commands like 'cd'.

~~~
mhansen
That's the main reason I'm not using RVM. I _depend_ on `cd` to work, every
time, rock solid, especially when my system is unstable. I can't risk having a
dependency or bug in their `cd` script breaking my most commonly used shell
command.

~~~
hadis
So then what did you use on your development machine to test your ruby apps
with till now? What did you use if not RVM? I am happy that RVM exists and
made my life as ruby developer much easier even if it overrides 'cd'. Also to
note i never had problems with RVM. Your main reason not using RVM is poor, as
if there were more options out there till now.

~~~
boz666
.bash_profile? How hard is that?

ruby==ruby 1.8.7 ruby9==ruby 1.9.2 jruby== jruby 1.6 jruby5==jruby 1.5

Yeah, real tough.

------
kaylarose
Besides the whole `cd` override thing, I am curious why so many people are
"confused" or have problems with RVM? (This is a genuine question. I've never
had problems with RVM, but obviously others have, so I am curious)

------
swatermasysk
I love the simplicity of Rbenv. I also love the "it's never good enough"
mentality. I have not had any issues with RVM, but that doesn't mean people
like Sam shouldn't try to build something better.

~~~
clupprich
I think this quite reflects the whole evolution theory - something quite good
is replaced by something a little bit better, which is again replaced by
something a bit better, and so on, and so on, and so on.

~~~
akmiller
It more so to me reflects the knee-jerk reaction of many in the Ruby community
to jump to newer projects simply because they are newer. I like rvm a lot and
use it all the time. I'm sure rbenv is a good solution as well. I think it's a
bit premature to say it's an overall better solution.

------
grimen
Makes sense, though I'll stick to RVM until I change my mind - RVM floats my
boat, haven't had any serios issues and I live in the shell. Bad short-term
(community confusion), good long-term (evolution of initial innovation). I'm
very neutral here.

I got a simple solution for all you distro vs RVM people: People who prefer to
use RVM - use RVM, people who prefer to use distro - use distro. Until you
have proven that a server that runs distro is 2x more valuable in $ - post on
HN and we could review it again. Reminding you of that we don't live in a
totally symmetric universe.

------
freedrull
Yes RVM is a crazy hack, but that's why I love it! Has anyone actually had
problems with RVM overriding 'cd'? Has RVM changed the behavior of 'cd' in a
way that was a problem for you?

~~~
telemachos
> Has anyone actually had problems with RVM overriding 'cd'?

I did, in two different ways. The first time, _cd_ was returning the wrong
exit status. (That is, it had become a function and was returning the exit
status of its last command, rather than the exit status of the actual _cd_
call. A common gotcha when you override shell built-ins or other commands.)
The incorrect exit status caused a number of shell scripts completely
unrelated to rvm to break. That made it harder to debug, obviously. The second
time I had trouble, TAB autocompletion with _cd_ was broken. At one point, rvm
was doing its own autocompletion for cd, although the last time I looked, it
no longer does that by default. (Yeah, just checked - that code path is still
opt-in by setting rvm_cd_complete_flag=1.)

Having said that, both times when I went into #rvm on Freenode to talk to
Wayne about it, he could not have been more helpful.

Having said _that_ , I still wish that as a design decision, rvm didn't
override cd.

------
bonzoesc
It would be somewhat cool if ruby-build knew how to look for an rbenv folder
to install rubies into, or if rbenv knew how to drive ruby-build to put rubies
in the right directory, but otherwise it's pretty nice.

~~~
sstephenson
That's a good idea... ruby-build could provide an `rbenv-install` plugin
command for rbenv.

~~~
stock_toaster
ruby-build seems fairly small. Have you considered just including it inside
rbenv's bin directory?

That may decrease the friction and improve the 'git checkout rbenv, add path,
and get started' workflow.

~~~
telemachos
It is fairly small, but I think part of the idea is to decouple rbenv from
_how_ or with what tools you build Rubies. (It might make sense, though, for
someone to create and maintain a fork that bundles ruby-build and rbenv.)

------
jarin
Pretty nice, but I actually do really like having gemsets. It gets me as close
to the production environment as possible, plus it makes it really easy to
clean up unused gems when I'm done with a project.

~~~
nzadrozny
For that, I use Bundler and always install gems to vendor/bundle for maximum
isolation and easy cleanup.

:~ which bi

bi: aliased to bundle install --path vendor/bundle

~~~
hadis
but does this not increase the size of your source control repository?

~~~
zszugyi
No, just add the directory to .gitignore.

------
uxp
For anyone that grew up outside of using a Bourne Shell (bash, sh, etc) like
myself, this appears to be compatible with at least the C shell. A welcome
relief, in my opinion.

------
bricestacey
I just uninstall rvm and install rbenv. It seems to work so far. I'm glad to
switch. rvm confused the hell out of me.

------
X4
I upvote this because RVM caused me more pain than salvation. I regret the
time wasted for RVM. Thanks for this vamsee!

------
derekprior
I appreciate RVM and Wayne offers fantastic, other-worldly support. That said,
there's always room for alternatives and I'm intrigued by rbenv. The part that
gives me pause is the need to run `rbenv rehash` after installing a ruby (not
so bad and possibly fixable if the aforementioned change to ruby-build is
made) or after installing a gem that has binaries (I predict I will forget to
do this a ton).

I could definitely see myself wanting to override `gem` in order to detect
binary installations and automatically rehash. At which point, it's not so
unobtrusive!

Still interested enough to try it out and see if that is as much of a hassle
as I think it will be.

------
NARKOZ
Is it production ready? RVM is.

~~~
bonzoesc
I don't see a pressing need to use RVM in production; when I deploy, I pick a
Ruby version and stick with it unless there's a security issue, at which point
I pull the updated REE package from Phusion/let Heroku figure it out.

Considering the many times I've seen RVM installs fail due to checked-in
broken code, I'd hardly call it "production ready" either.

~~~
SpikeGronim
I have to use rvm in production because debian/ubuntu install ruby 1.8 and I
need 1.9.2 for rails 3. Ruby isn't in the alternatives system (yet - coming
soon) so I don't see a better way.

~~~
alrs
apt-get install ruby1.9. It's in there.

~~~
sanderjd
1.9.1 is there, 1.9.2 is not. But I still the the better solution is to build
from source on each machine, or create a custom 1.9.2 package for the machines
you will be using. As other comments have pointed out, RVM is held together
with string and duct tape and breaks frequently. I haven't dug into the code
from this project, but being more testable and maintainable would be one of
the biggest wins they could achieve from my point of view.

~~~
nona
I have to contradict you (unless I'm misunderstanding you): the debian package
named ruby1.9.1 is actually 1.9.2. The 1.9.1 refers to the ruby ABI. Blame the
ruby devs for breaking the ABI in a minor version update (1.9.0 -> 1.9.[12]).

------
metaskills
We are software nerds people. It is supposed to be cool to se how others solve
problems. It is as simple as that.

------
hadis
With RVM you can change the rubygems version for an installed ruby
interpreter. Is something like these possible with rbenv too? i use rubygems
-v 1.3.6 for ruby-1.8.7 and rubygems -v 1.8.6 for ruby-1.9.2. I remember i had
problems using rubygems 1.8.6 with ruby-1.8.7

~~~
dalyons
Really damn handy feature, especially with the compatibility clusterfuck that
has been rubygems > 1.3.6

------
rubyplusplus
I've never had any problems with RVM, however with that said I will absolutely
check out the code on github and may try this out.

------
revscat
This looks promising because it looks like it will work seamlessly with
tmux/screen, something rvm struggles with.

~~~
axomhacker
What problems did you see using rvm with screen? I use that daily and haven't
seen any problems so far.

~~~
revscat
I am currently porting a Ruby application over to JRuby, and use tmux
(although I am pretty sure screen would behave the same). Let's say you have
two rubies installed, ree and jruby. You start out using ree, and are using
screen/tmux, and have two screens open.

If you switch to JRuby in the first screen, then switch to the second, the
changes don't propagate. e.g.:

(first screen)

    
    
      $ rvm list
    
      rvm rubies
    
      => jruby-1.6.3 [ darwin-i386-java ]
         ree-1.8.7.2001.03 [ x86_64]
    

(second screen)

    
    
      $ rvm list
    
      rvm rubies
    
         jruby-1.6.3 [ darwin-i386-java ]
      => ree-1.8.7.2001.03 [ x86_64]
    

It's not a big deal -- you just have to make sure you do the right thing --
but it is unexpected and has burned me a couple of times. It looks like rbenv
won't suffer from this problem.

~~~
Gibheer
But thats exactly, what I expect from rvm. When i'm in in one projecti want
too to use that Ruby with that gelder and not the other Ruby and gemset. So
rbvm is not want I want to use with tmux.

~~~
revscat
This is in the same project.

------
solid
Good to see competition. RVM's "bug tracker" is the IRC channel...

------
iancanderson
was this really necessary? i think RVM does a fine job at managing rubies.

------
xkumados
rvm is easier to type than rbenv. i know aliases exist but whyyyyy? roarrr

