Skip to content
This repository

.ruby-version in parent dir leads to incorrect rbenv Ruby #363

tilsammans opened this Issue April 05, 2013 · 12 comments

9 participants

Joost Baaij John Metta Junichi Ito Emerson Lackey Guido Bouman Scott Tadman Jeremy Baker Mario Uher regedarek
Joost Baaij

My apps live in ~/Rails/ and each have a .ruby-version. Rails server runs fine. But Pow always wants to load the Ruby specified in the parent dir a.k.a. my home dir: ~/.ruby-version.

When I remove ~/.ruby-version, Pow correctly loads rbenv from the Rails application directory and the correct Ruby. So there's a path lookup going haywire somewhere. The .ruby-version in the application directory should always win, IMO.

Mac OS X 10.8.3 with zsh and Oh-My-Zsh.

John Metta

I found this gist, which sort of forces the issue locally by updating your project's .powrc with the following:

if [ -f "$rvm_path/scripts/rvm" ]; then
  source "$rvm_path/scripts/rvm"

  if [ -f ".rvmrc" ]; then
    source ".rvmrc"

  if [ -f ".ruby-version" ]; then
    rvm use `cat .ruby-version` 

  if [ -f ".ruby-gemset" ]; then
    rvm gemset use --create `cat .ruby-gemset`
Junichi Ito

I got the same issue and had to delete .ruby-version in my home dir. Hope it would be fixed soon.

Emerson Lackey

I just hit this issue as well. Took me half a day to find this post.

Guido Bouman

It usually doesn't make a lot of sense to have a .ruby-version in your home dir, that's more or less what's the rbenv global is for.

I'll dig into it though. As nested projects should give the deepest .ruby-version precedence.

Scott Tadman

Just got hit with this particular issue. rbenv uses the deepest reference, and Pow seems to use the top-most, which is inconsistent.

It doesn't make sense to have it in your home directory, but if you've done a rbenv local x.x.x by accident there, you wouldn't notice, as your applications are still keyed correctly.

Guido Bouman

The way rbenv works is that it figures out the directory it's running in, and uses the corresponding Ruby version. Somehow rbenv believes that the home directory has precedence over the project directory...

Pow does not do anything to change this behaviour. This is because rbenv replicates native functionality in a really neat way. Simply put: Rbenv is in control of ruby versions at all times. (

This error might be occurring because of the way the pow symlinking is set up. This would be a rbenv bug though, not a pow bug. @sstephenson, as author of both tools, what's your opinion?

Jeremy Baker

Just hit this as well after upgrading to OSX Mavericks. Wasted nearly half a day trying to figure it out. :-1:

Scott Tadman

What is especially confusing about this issue is running rails or rake test in the application directory will run the correct version of Ruby, the one specified for that particular application, but Pow will instead use the one defined in the home directory. If rbenv is in control, the way it's being engaged isn't the same as via the command-line.

This issue is really confusing as everything you do on the command line works, and everything you do through Pow is broken. Normally the two are in sync and it's possible to reproduce Pow loading problems with rails c.

Mario Uher

Bit me too!


I have the same issue here. After fresh Mavericks install. Then rbenv using homebrew, installed 2.0.0p247. Also installed rbenv-bundler. And set .powconfig in root directory.

But pow can't recognise correct ruby version and throw:

LoadError: cannot load such file -- bundler/setup
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
~/Code/app/config/boot.rb:4:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
cardiogo(development)» gem env
RubyGems Environment:
  - RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [universal.x86_64-darwin13]
  - INSTALLATION DIRECTORY: /Users/rege/.gem
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/rege/.gem/bin
    - ruby
    - universal-darwin-13
     - /Users/rege/.gem
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-rdoc --no-ri"
Guido Bouman

@regedarek This might be a different issue. If you remove the .ruby-version in the parent directory of your application (or home directory), everything should work well.

If the problem is still occurring and you use zsh, check this out: #202 (comment)


Hi, Thanks a lot. #202 (comment) solved with my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.