Skip to content
This repository has been archived by the owner on May 15, 2020. It is now read-only.

rbenv does not work well with pow #202

Closed
nogenhat opened this issue Aug 17, 2011 · 68 comments
Closed

rbenv does not work well with pow #202

nogenhat opened this issue Aug 17, 2011 · 68 comments

Comments

@nogenhat
Copy link

No description provided.

@jpantuso
Copy link

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.

@nogenhat
Copy link
Author

Yep, i inspected the pow sources, and totay push the fix.

Sent from my iPhone

On Aug 18, 2011, at 1:14 AM, jpantusoreply@reply.github.com wrote:

I've burned a few hours on this today. 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.

Reply to this email directly or view it on GitHub:
#202 (comment)

@mstarkman
Copy link

Where can the code for this be found?

@jpantuso
Copy link

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

@mhfs
Copy link

mhfs commented Aug 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

@mstarkman
Copy link

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.

@jpantuso
Copy link

Worked for me. Created file, restarted via powify, all good.

-J

Typos courtesy of iPhone

On Aug 19, 2011, at 2:38 PM, mstarkman
reply@reply.github.com
wrote:

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.

Reply to this email directly or view it on GitHub:
#202 (comment)

@josh josh closed this as completed Sep 7, 2011
@mislav
Copy link

mislav commented Sep 29, 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).

@asymmetric
Copy link

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

@mislav
Copy link

mislav commented Oct 8, 2011

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.

@levifig
Copy link

levifig commented Oct 8, 2011

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

@catsby
Copy link

catsby commented Oct 21, 2011

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

@asymmetric
Copy link

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

@daz
Copy link

daz commented Nov 2, 2011

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

@catsby
Copy link

catsby commented Nov 2, 2011

@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
Copy link

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

@gonglexin
Copy link

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

@edsinclair
Copy link

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.

@catsby
Copy link

catsby commented Nov 11, 2011

@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

@edsinclair
Copy link

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.

@catsby
Copy link

catsby commented Nov 11, 2011

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

@edsinclair
Copy link

@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
Copy link

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.

@prathe
Copy link

prathe commented Nov 25, 2011

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

@mystix
Copy link

mystix commented Feb 21, 2012

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

@tfwright
Copy link

tfwright commented Mar 4, 2012

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

@soffes
Copy link

soffes commented Jun 7, 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"

@sstephenson
Copy link
Contributor

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

@soffes
Copy link

soffes commented Jun 7, 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.

@camdub
Copy link

camdub commented Oct 8, 2012

@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

@camdub
Copy link

camdub commented Oct 8, 2012

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.

@jmccartie
Copy link

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

@esambo
Copy link

esambo commented Oct 18, 2012

@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](/rbenv: 2.1 Basic GitHub Checkout) and [https://github.com/sstephenson/ruby-build#installing-as-an-rbenv-plugin-recommended](ruby-build: Installing as an rbenv plugin %28recommended%29) which fixed this issue.

@jmccartie
Copy link

Issue resolved.

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

@sj26
Copy link
Contributor

sj26 commented Nov 29, 2012

This worked for me, in ~/.powconfig:

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

@xurde
Copy link

xurde commented Dec 24, 2012

@sj26 Thanks
Worked for me as well.

@cointilt
Copy link

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.

@jhubert
Copy link

jhubert commented Apr 19, 2013

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.

@tvdeyen
Copy link

tvdeyen commented Apr 22, 2013

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

@guidobouman
Copy link

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

@chourobin
Copy link

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

@mariozaizar
Copy link

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)

@sj26
Copy link
Contributor

sj26 commented Oct 24, 2013

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.

@rrichards
Copy link

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.

@mikker
Copy link

mikker commented Oct 31, 2013

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

@guidobouman
Copy link

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

@vicovictor
Copy link

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.

@gabrieljoelc
Copy link

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

@erichurst
Copy link

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

@tsmango
Copy link

tsmango commented Feb 1, 2015

@victorngkp 👍 Thanks!

@lacostenycoder
Copy link

one more 👍 @victorngkp

@christianRakete
Copy link

👍 @victorngkp

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests