rbenv does not work well with pow #202

nogenhat opened this Issue Aug 17, 2011 · 67 comments

No description provided.


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'


Where can the code for this be found?


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


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


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.

@josh josh closed this Sep 7, 2011

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).


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


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.


@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!


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


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

daz commented Nov 2, 2011

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


@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

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


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


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.


@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


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.


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


@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.


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.


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


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


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


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"
Basecamp member

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 :)


@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.

Basecamp member

@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.


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

UserShell: /bin/zsh

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


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)

I fixed rbenv + brew + pow issue with

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

in ~/.powconfig and restarting machine


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"
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


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.



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



@insside Your suggestion worked for me. Thank you!


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


+1 for @esambo's solution. Thanks


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"

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

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


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.


@camdub can you show echo $PATH output?


@insside here is the output:



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.


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:


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


@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.


Issue resolved.

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


This worked for me, in ~/.powconfig:

export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"

@sj26 Thanks
Worked for me as well.


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.


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.


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 ❤️


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

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

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)


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.


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.


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

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))


For all who have added a .powconfig configuration file, restarted, etc. and to no avail, make sure you do not have a .ruby-version in your home directory ~/.ruby-version. If you had, delete it.


@victorngkp 👍. Didn't do any of the above except for delete my accidental ~/.ruby-version and it fixed all the things.


👍 @victorngkp. Forgot I had that .ruby-version file in the home dir. Thanks for the reminder.


@victorngkp 👍 Thanks!


one more 👍 @victorngkp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment