Skip to content
This repository

rbenv does not work well with pow #202

Closed
reizenikker opened this Issue August 17, 2011 · 62 comments
Ivan Nastyukhin

No description provided.

Joe Pantuso

I can't get pow to hit anything but the system Ruby.

  • rvm has been imploded
  • I've reinstalled Pow just in case
  • Set both global and local rubies with rbenv
  • reinstalled gem
  • bundled (app works fine if started with rackup)

And still I get:

LoadError: no such file to load -- bundler/setup
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
etc.

Ivan Nastyukhin
Mark Starkman

Where can the code for this be found?

Joe Pantuso

No new commits on any branch at nzt or 37signals?

Marcelo Silveira
mhfs commented August 19, 2011

Thomas Fuchs tweeted a workaround until this gets fixed.

Add this to your ~/.powconfig (changing the username of course):

export PATH="/Users/username/.rbenv/shims:/Users/username/.rbenv/bin:$PATH"

Worked for me.

Source: https://twitter.com/#!/thomasfuchs/status/102116945360465921

Mark Starkman

Unfortunately, that fix didn't seem to work for me. I tried re-install pow as well after the config change and that didn't help either.

UPDATE: It working for me now, just needed to reboot! Thanks for posting the tweet.

Joe Pantuso
Joshua Peek josh closed this September 06, 2011
Mislav Marohnić

Updated: this might not be optimal after all. See my comment below.

I've done this with my ~/.powconfig:

# cat ~/.powconfig 
export PATH=$(rbenv prefix)/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

No usernames to change, no internal structure of rbenv exposed, works even when you move rbenv to another location (as long as rbenv itself is in the PATH).

Lorenzo Manacorda

Neither of the two solutions involving ~/.powconfig worked for me, even after restarting via launchctl. Can we reopen this?

Mislav Marohnić

Not sure why it doesn't work for you, but I've noticed a bug with my solution above: it skips the rbenv shims, going straight to the original binaries of the current ruby version. This skips rbenv plugins completely.

Levi Figueira

@asymmetric I installed powder (gem install powder), ran powder config and notice I had an issue with my .powconfig. By the way, don't use quotes while setting shell variables. My .powconfig looks like this:

export PATH=/Users/levifig/.rbenv/shims:/Users/levifig/.rbenv/bin:$PATH

Restart your shell and pow and enjoy! :)
Hope it helps!

Clint

If you installed rbenv via Homebrew make sure you modify that second path accordingly or you'll spend an hour wondering why this works for everyone else but you

Lorenzo Manacorda

Turns out it doesn't work if you use ~ instead of specifying a full path. Any idea why that is?

Darren Jeacocke

@ctshryock Which 'second path' are you referring to?

Clint

@ctshryock Which 'second path' are you referring to?

/Users/<username>/.rbenv/bin. After installing with Homebrew, the actual rbenv script is in /path/to/homebrew/bin

# ~/.powconfig
export PATH=/Users/clint/.rbenv/shims:/Users/clint/Developer/bin:$PATH
Gurpartap Singh

If anyone here is using zsh, you need to put the eval "$(rbenv init -)" in .zshenv instead of .zshrc (.zshrc only loads for shells).

Lexin Gong

You may need to restart POW by killing it in the Activity Monitor or in Terminal after your doing the config changes

Eirik Dentz Sinclair

Gurpartap: thank you so much for that comment regarding zsh. That saved me a lot of time. It would be great to get the rbenv and pow docs regarding the use of zsh updated so that it is clear that you need to add the PATH config and the eval lines to .zshenv rather than .zshrc in order to use pow with rbenv

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

And then of course killing POW so that it gets restarted by launchctl is necessary so that POW gets loaded in that env.

Clint

@edsinclair I'm not sure the docs are wrong; I don't have anything in my .zshenv and I have rbenv working fine with Pow

Eirik Dentz Sinclair

Interesting. I tested this a bit restarting pow each time and can confirm that on my system POW does not find rbenv unless I put the shell configuration lines in .zshenv rather than .zshrc. Not sure if this issue with how .zsh is installed or which version of zsh one runs. I guess the docs may be correct for some, but if you have an issue it is worth a try to put the rbenv shell config lines in .zshenv.

Clint

@edsinclair what about your ~/.powconfig?
My rbenv is in ~/Developer/bin
export PATH=/Users/clint/.rbenv/shims:/Users/clint/Developer/bin:$PATH

Eirik Dentz Sinclair

@ctshryock ah that works as well. Thanks for that. Though I tried it using the $HOME shell variable and that did not work as @asymmetric pointed out above regarding the ~ home dir alias. Not sure I feel entirely comfortable with a solution that requires hardcoding the path as @mislav pointed out in his imperfect solution... So I may stick with the .zshenv solution as it seems like there may be other processes besides POW that I'd want using rbenv. For example in the past I've written/used ruby scripts that run via launchctl.

It does seem like a mention of using .zshenv instead of .zshrc would be worth mentioning in the rbenv docs. So I should have made that comment over there, instead of here :)

Thanks again.

Gurpartap Singh

Afaik, .zshrc is just for the shells and to loads the evn variables for both shells and programs, you have to put them in .zshenv. That is how pow gets to discover rbenv.

Philippe Rathé

Thanks @Gurpartap, you made me realize I was setting it in both zshrc and zshenv.

Marc

Just a quick update: using /Users/`whoami` in place of $HOME in .zshenv works, removing the need to hardcode the home path.

Floyd Wright

Just had this issue. With fresh install of Lion/rbenv. Resolved as per comments above by adding the following to ~/.powconfig, but I also had to reboot the machine.

export PATH=/Users/whoami/.rbenv/shims:/Users/whoami/Developer/bin:$PATH

Sam Soffes
soffes commented June 07, 2012

I'm running ZSH on Lion. The only change I had to do was edit the path in ~/.powconfig. This worked for me:

$ cat ~/.powconfig
export PATH="/Users/`whoami`/.rbenv/shims:$PATH"
Sam Stephenson
Owner

Note: Zsh users won't need to make any changes to ~/.powconfig in the upcoming 0.4.0 release. We are now going to great lengths to load the login environment no matter what your shell is :)
https://github.com/37signals/pow/blob/master/src/util.coffee#L143-239

Sam Soffes
soffes commented June 07, 2012

@sstephenson I just installed the latest (the install script said 0.4.0) and it was using system ruby. I added back my .powconfig and it started working again.

Sam Stephenson
Owner

@samsoffes What does dscl . -read ~ UserShell report? It sounds like you might've just changed your shell using Terminal preferences rather than chsh or System Preferences.

Sam Soffes
soffes commented June 07, 2012

@sstephenson I used chsh. Here's the output of that command:

UserShell: /bin/zsh
Mislav Marohnić
mislav commented June 08, 2012

@sstephenson It doesn't seem to work with zsh as login shell. Please see #294

Chris Sessions

bash + Homebrew-installed rbenv + command line installed Pow 0.4.0 are working after:

  1. adding export PATH="/Users/`whoami`/.rbenv/shims:$PATH" to ~/.powconfig
  2. restarting machine (restarting Pow was not enough)
Tima Maslyuchenko
timsly commented June 21, 2012

I fixed rbenv + brew + pow issue with

export PATH=`brew --prefix rbenv`/shims:`brew --prefix rbenv`/bin:$PATH

in ~/.powconfig and restarting machine

John Griffiths

this partially worked for me, I had installed rbenv with homebrew so soon guessed POW couldn't find the rbenv executable.

export PATH="/usr/local/Cellar/rbenv/0.3.0/bin:/Users/john/.rbenv/shims:/Users/john/.rbenv/bin:$PATH"
Tima Maslyuchenko
timsly commented July 18, 2012
brew --prefix rbenv

generate correct path to current version isntalled with homebrew, so once you update rbenv with homebrew you do not need update configuration file

John Griffiths

tried that, no go. my system's pretty messed up anyway so a fresh install is probably on the cards soon. will try again then.

John Griffiths

solved.

installing rbenv with homebrew fails to create the .rbenv/bin dir, installing with git works.

https://github.com/sstephenson/rbenv/#section_2.1

Rajiv M Ranganath

@insside Your suggestion worked for me. Thank you!

E. Sambo

This worked for me:
Create or modify: ~/.powconfig with:

eval $(rbenv init -)
export PATH=$(rbenv root)/shims:$(rbenv root)/bin:$PATH

and then restart pow: touch ~/.pow/restart.txt

Test the PATH used by pow: curl -H host:pow localhost/env.json

I also fixed my rbenv root location since I installed it with homebrew: ln -s /usr/local/opt/rbenv ~/.rbenv

Jevin Maltais

+1 for @esambo's solution. Thanks

Joshua Kunzmann

If you happen to be working with others who prefer rvm and your .powrc is checked in, you can use this:

if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ]; then
  source "$rvm_path/scripts/rvm"
  source ".rvmrc"
fi

if [ $(command -v rbenv 2>&1) ]; then
  export PATH=$(rbenv root)/shims:$(rbenv root)/bin:$PATH
fi
Kevin Bombino

+1 for @insside solution on a Mac 10.7 Lion with Homebrew RVM and shell-installed Pow

Cameron Woodmansee

I'm still getting a LoadError: cannot load such file -- bundler/setup error when trying to run my app from pow. I tried making the changes in this issue, but still get the same error.

The stack trace is showing ~/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'` so I'm assuming its finding rbenv okay. I'm not sure what's wrong.

Tima Maslyuchenko

@camdub can you show echo $PATH output?

Cameron Woodmansee

@insside here is the output:

/Users/camdub/Developer/.rbenv/shims:/Users/camdub/Developer/.rbenv/bin:/Users/camdub/Developer/bin:/Users/camdub/Developer/Cellar/python/2.7.1/bin:/Users/camdub/Developer/share/python:/Users/camdub/Developer/sbin:/Users/camdub/Developer/.rbenv/shims:/Users/camdub/Developer/.rbenv/bin:/Users/camdub/Developer/bin:/Users/camdub/Developer/Cellar/python/2.7.1/bin:/Users/camdub/Developer/share/python:/Users/camdub/Developer/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Cameron Woodmansee

Fixed my own problem. For some reason, I had two shims directories--one in ~/.rbenv/shims and one (as seen above) in ~/Developer/.rbenv/shims. Editing my ~/.powconfig to use the shims path in ~/Developer fixed the issue.

Jon McCartie

Git installed rbenv and rbenv-build. getting the LoadError: cannot load such file -- bundler/setup error. Tried @insside 's solution above by adding export PATH=`brew --prefix rbenv`/shims:`brew --prefix rbenv`/bin:$PATH to my ~/.powconfig and restarting. No dice.

Here's my path:

/Users/jon/.rbenv/shims:/Users/jon/.rbenv/bin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:

And here's the error:

LoadError: cannot load such file -- bundler/setup
~/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'

Any help?

Running OS X 10.8.2

E. Sambo

@jmccartie Verify the contents of you rbenv shims /Users/jon/.rbenv/shims and bin /Users/jon/.rbenv/bin directory that you mentioned in your PATH. One of them was empty for me because it was in /usr/local/... (because I installed rbenv through Homebrew).
I just uninstalled rbenv and ruby-build (brew uninstall rbenv ruby-build) and installed it without Homebrew (based on https://github.com/sstephenson/rbenv#-21-basic-github-checkout and https://github.com/sstephenson/ruby-build#installing-as-an-rbenv-plugin-recommended which fixed this issue.

Jon McCartie

Issue resolved.

Someone had placed stuff into .powenv which was jacking with things. Thanks @esambo

Samuel Cochran

This worked for me, in ~/.powconfig:

export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
Jorge Díaz

@sj26 Thanks
Worked for me as well.

Will Ayers

I fixed this by installing the gem powify:

gem install powify

I then add the following script to ~/powconfig:

export PATH="/Users/username/.rbenv/shims:/Users/username/.rbenv/bin:$PATH"

Replacing username with the same dir as your username. I am sure there is a dynamic way that works but I ran into trouble with that.

I then ran the install script for pow again:

curl get.pow.cx/install.sh | sh

And last command I ran was:

powify restart railsappname

Replace railsappname with the name of your rails app

I another thing you must make sure when using rbenv is to run gem install bundler on each version of rails you have installed.

Jeremy Baker

Just to confirm, we recently had this problem and we were getting the following error:

Bundler::RubyVersionMismatch: Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3

The problem was that he was running zshell and it wasn't initializing rbenv before pow ran. We fixed it using Gurpartap and edsinclair's advice above. Killing pow using Activity Monitor was the important part.

Thomas von Deyen

Thanks @esambo

This worked for me:
Create or modify: ~/.powconfig with:

eval $(rbenv init -)
export PATH=$(rbenv root)/shims:$(rbenv root)/bin:$PATH

and then restart pow: touch ~/.pow/restart.txt

Works great for Pow 0.4.0 via homebrew under 10.8.3 :heart:

Guido Bouman

I prefer moving the following from my .zshrc file to my .zshenv file:

# Initialize rbenv
eval "$(rbenv init -)"

That's because it fixes the issue for each app that does not load the shell, but does load the environment. In that way you don't have any duplicated configurations as it will not be inside your .zshrc file anymore and there's no need to copy it to your ~/.powconfig. Also, the init command adds the shims to PATH, so no need to add those separately. (https://github.com/sstephenson/rbenv#homebrew-on-mac-os-x)

By the way @sstephenson, this issue was still existent for me on v0.4.1.

> dscl . -read ~ UserShell
UserShell: /bin/zsh
Robin Chou

I installed pow with Homebrew and edited the correct path in my .powconfig file. It wasn't working until I restarted pow using lunchy:

lunchy restart pow
Mario Zaizar

I just upgrade to OSX Mavericks and the issue is back.
I tried with export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" and:

eval $(rbenv init -)
export PATH=$(rbenv root)/shims:$(rbenv root)/bin:$PATH

Brew doctor says everything is OK. I reinstalled the gem and pow. Restarted the process and terminal. Nothing works.
If I install bundler on @global it works. But now, pow is ignoring my .ruby-version (so trying to use ruby2 from the system)

Samuel Cochran

No issues with mavericks here.

Make sure you've got those lines in your ~/.powconfig and have restarted pow? You can also check the logs in Console.

Ryan Richards

Also have the issue with Mavericks

-- update

I think it may be because im using an rbenv gemset via the rbenv-gemset plugin. Ill try without it.

Mikkel Malmberg

Fixed this problem on Mavericks using both pow and rbenv from Homebrew:

export RBENV_ROOT=/usr/local/var/rbenv # <-- this was what I needed
eval $(rbenv init -)
export PATH=$(rbenv root)/shims:$(rbenv root)/bin:$PATH
Guido Bouman

This has been accounted for in #358.

Only .zshrc would not properly be picked up. Now it is. Get the most recent version of pow and all the weird customisations should not be needed.

If you don't want to install pow from GitHub, see my earlier comment for my setup that has not ever had issues, even on Mavericks. (#202 (comment))

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.