rbenv: rbenv: rails: command not found
How do you run gem executables without Bundler / bundle exec
?
~ $ rbenv rehash
~ $ rbenv global
1.9.2-p290
~ $ gem which rails
/Users/meleyal/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/railties-3.1.0/lib/rails.rb
~ $ rails new test
rbenv: rails: command not found
The `rails' command exists in these Ruby versions:
1.8.7-p352
~ $ bundle exec rails new test
Could not locate Gemfile
About this issue
- Original URL
- State: closed
- Created 13 years ago
- Comments: 85 (10 by maintainers)
You need to
gem install rails
for every version of Ruby in which you want to use therails
command outside of a Bundler project. Looks like you have it installed for 1.8.7-p352, but not 1.9.2-p290.gem install railties did the trick!
gem install railties && rbenv rehash
Not to keep things running but did you perform rbenv rehash?
On Tue, Oct 4, 2011 at 12:56 PM, Michael Minton < reply@reply.github.com>wrote:
I had the same issue and I solved it by reinstalling railties (instead of rails) as the rails binary is in railties gem:
Turns out you need to use rbenv exec to get the rails binary in the right spot:
rbenv exec gem install rails
Had this problem. @veilleperso 's solution worked for me.
(then completely close terminal and reopen)
I did.
Update: I installed via Homebrew and missed that you have to manually add
eval "$(rbenv init -)"
to your profile. That’s very likely your problem as well Eric. /sighI actually got the same problem today. I’ve got Rails installed for both my rails versions but I still get the following while running
rails -v
in other versions except 1.8.7.Standing in my current project having a .rbenv-version file containing
1.9.2-p290
and runningrbenv rehash
andgem list rails
I get the following output:I double checked to see if this is the right Ruby version by doing
rbenv version
and got the following output:Any ideas on the problem?
I had the same or similar issue…
Turns out I had something at
/usr/bin/rails
. I’m not really sure where it came from, but Isudo rm
’d it FTW. Hope it helps.New install of rbenv and freshly built rubies. Set 1.9.3 to be my global ruby. Then tried:
If I open a fresh terminal, though, rails -v reports the correct version. What the heck is going on here? Any ideas?
@rebelwarrior put some context 😃
$ rbenv versions $ ruby -v $ rbenv rehash $ gem list rails $ uname -a
when i run chef-client with then i am getting this error even though i have installed 2.1.0 and 2.3.1 both ruby version using rbenv.
The `bundle’ command exists in these Ruby versions: 2.1.0 stuck with this issue, can anyone help me
@tmartyny You have to install Bundler for each Ruby version just intend to use it on. When you did
rbenv global 2.2.2
that doesn’t mean that the global version applied to your current directory. Maybe there was a.ruby-version
file in the local directory specifying a different Ruby version. In any case, you can install bundler for all Ruby versions with:I had the same issue and the solutions above didn’t fix my problem. This error came up for me after upgrading my global Ruby version to 2.2.2. After upgrading I had to run:
rbenv shell 2.2.2
once I set that, I was then able to install bundler and then bundle in my app directory. Here is the stackoverflow post that helped me: http://stackoverflow.com/questions/17562426/installing-gems-to-which-ruby-with-rbenv
(I’m using zsh.) Instead of quitting your shell, run
eval "$(rbenv init -)"
. It seems to update zsh completions and that makes my shell find the rightrails
(~/.rbenv/shims/rails
). I wonder whyrbenv rehash
didn’t solve this.Edit:
I can’t repeat it, now
rbenv rehash
works fine:yeah, just quit Terminal and opened a new shell.
Thansk for the suggestion but it doesn work for me:
I just did a fresh install of Lion. After installing rbenv, ruby and rails I am unable to run
rails
from terminal. It simply states"Rails is not currently installed..."
. However, I can runrbenv exec rails
with no problem. Any suggestions?