Rails keeps telling me that it's not currently installed
Asked Answered
T

31

117

I use rvm to manage different rubies and their gemsets. My shell is zsh with oh-my-zsh configured with basic settings. Enabled oh-my-zsh plugins are ruby, rails, osx, and git. Here's the command I used to install ruby-1.8.7 and rails-3.0.7.

rvm install 1.8.7
rvm use 1.8.7
gem install rails -v=3.0.7

and then I typed rails and got:

Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.

I've tried more thorough installs also, Like reinstall rubygems after switching to ruby-1.8.7, or create a completely new gemset, but with no luck.

Here's the rvm info:

ruby-1.8.7-p352@rails:

  system:
    uname:       "Darwin yicai.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.8.6 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.8.7"
    date:         "2011-06-30"
    platform:     "i686-darwin10.8.0"
    patchlevel:   "2011-06-30 patchlevel 352"
    full_version: "ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10.8.0]"

  homes:
    gem:          "/Users/nil/.rvm/gems/ruby-1.8.7-p352@rails"
    ruby:         "/Users/nil/.rvm/rubies/ruby-1.8.7-p352"

  binaries:
    ruby:         "/Users/nil/.rvm/rubies/ruby-1.8.7-p352/bin/ruby"
    irb:          "/Users/nil/.rvm/rubies/ruby-1.8.7-p352/bin/irb"
    gem:          "/Users/nil/.rvm/rubies/ruby-1.8.7-p352/bin/gem"
    rake:         "/Users/nil/.rvm/bin/rake"

  environment:
    PATH:         "/Users/nil/.rvm/gems/ruby-1.8.7-p352@rails/bin:/Users/nil/.rvm/gems/ruby-1.8.7-p352@global/bin:/Users/nil/.rvm/rubies/ruby-1.8.7-p352/bin:/Users/nil/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/sbin"
    GEM_HOME:     "/Users/nil/.rvm/gems/ruby-1.8.7-p352@rails"
    GEM_PATH:     "/Users/nil/.rvm/gems/ruby-1.8.7-p352@rails:/Users/nil/.rvm/gems/ruby-1.8.7-p352@global"
    MY_RUBY_HOME: "/Users/nil/.rvm/rubies/ruby-1.8.7-p352"
    IRBRC:        "/Users/nil/.rvm/rubies/ruby-1.8.7-p352/.irbrc"
    RUBYOPT:      ""
    gemset:       "rails"

and the gem version is 1.8.10, the latest.

Temperamental answered 17/10, 2011 at 2:59 Comment(0)
S
95

I had this problem today. Not completely related to your question, but since this page is what comes up in Google when I search for "Rails is not currently installed on this system", I thought I would add my answer:

What happened is that I was using ruby 1.9.2 with rails for a while, but then I needed to use ruby 1.8.7 to run some other script that I found.

Afterwards, I wanted to change by system back to using 1.9.2, and that's where the problem started:

$ rvm list

=> ruby-1.8.7-p352 [ x86_64 ]
ruby-1.9.2-p290 [ x86_64 ]


$ rvm use 1.9.2

I thought that would do the trick. But no, that gives me the "Rails is not currently installed on this system" message.

What I had forgotten is that I had configured rails using an rvm gemset. So I needed to specify the correct gemset when I was selecting which ruby version to make active.

$ rvm gemset list_all


gemsets for ruby-1.8.7-p352 (found in /Users/asgeo1/.rvm/gems/ruby-1.8.7-p352)
global


gemsets for ruby-1.9.2-p290 (found in /Users/asgeo1/.rvm/gems/ruby-1.9.2-p290)
global
rails31


$ rvm use ruby-1.9.2-p290@rails31

That did the trick.

Synergism answered 23/11, 2011 at 19:57 Comment(2)
I worked for me as well, even though I just had one version installed. It was set as default, but for some reason it was not set as current.Rabah
Thanks - after upgrading Ruby from 2.2.1 to 2.2.3, I started getting this error. rvm use ruby-2.2.1 made rails happy again.Powerdive
Z
180

If you're running a rails command immediately after installing rails, you will need to restart your terminal before your commands will be recognized.

Zolner answered 31/10, 2012 at 0:24 Comment(6)
doh! well there's 15 minutes of my life I'll never get back. thanks.Sukin
Thanks... this should have been on top. silly mistake that everyone makes.Alexanderalexandr
Worked for me. But why?Arabian
@AkashAggarwal because this executes the rvm script that allows the rails commands to be recognized (a step that was probably added to your .bash_profile during the install). Alternatively you can do what Dhaulagiri suggested to reload in the current shell.Zolner
This is the correct answer. Just restart your terminal.Robustious
Better answer: you have to read and execute the contents of the the configuration script. For ZSH it is : source ~/.zshrcDucan
S
95

I had this problem today. Not completely related to your question, but since this page is what comes up in Google when I search for "Rails is not currently installed on this system", I thought I would add my answer:

What happened is that I was using ruby 1.9.2 with rails for a while, but then I needed to use ruby 1.8.7 to run some other script that I found.

Afterwards, I wanted to change by system back to using 1.9.2, and that's where the problem started:

$ rvm list

=> ruby-1.8.7-p352 [ x86_64 ]
ruby-1.9.2-p290 [ x86_64 ]


$ rvm use 1.9.2

I thought that would do the trick. But no, that gives me the "Rails is not currently installed on this system" message.

What I had forgotten is that I had configured rails using an rvm gemset. So I needed to specify the correct gemset when I was selecting which ruby version to make active.

$ rvm gemset list_all


gemsets for ruby-1.8.7-p352 (found in /Users/asgeo1/.rvm/gems/ruby-1.8.7-p352)
global


gemsets for ruby-1.9.2-p290 (found in /Users/asgeo1/.rvm/gems/ruby-1.9.2-p290)
global
rails31


$ rvm use ruby-1.9.2-p290@rails31

That did the trick.

Synergism answered 23/11, 2011 at 19:57 Comment(2)
I worked for me as well, even though I just had one version installed. It was set as default, but for some reason it was not set as current.Rabah
Thanks - after upgrading Ruby from 2.2.1 to 2.2.3, I started getting this error. rvm use ruby-2.2.1 made rails happy again.Powerdive
S
41

Mac OS X, rbenv, and rails

I was getting the exact same issue but with rbenv rather than rvm. After verifying a correct .bash_profile.

.bash_profile

export PATH="$HOME/.rbenv/bin:/usr/local/bin:$PATH"

eval "$(rbenv init -)"

Restart the shell

exec $SHELL -l

Check the path

echo $PATH

Finally

I repeatedly installed and uninstalled rails but it was never placed in the .rbenv/bin directory after rbenv rehash. In the end I did a find . -name rails and uninstalled every gem that was returned and uninstalled rails. Then:

$ gem install rails
$ rbenv rehash

$ which rails
/Users/palmerc/.rbenv/shims/rails
Sandusky answered 14/4, 2013 at 9:38 Comment(2)
After gem install rails I hit the same issue. Like you said, running rbenv rehash did the trick. No need for a sudo.Mcallister
Restarting terminal did not work for me. rbenv rehash didSoluble
L
28

I had the same issue and found that RVM was not showing as installed either if I tried the rvm command. All it took to fix both problems was running this command in the terminal

$ source ~/.rvm/scripts/rvm
Locker answered 15/2, 2013 at 21:17 Comment(1)
Saved the day... Now what does it mean? :)Ageold
S
24

Restart your terminal and then re-run your rails command

Shaefer answered 14/10, 2016 at 0:0 Comment(0)
L
13

Rails is not reporting that it isn't installed. Your Debian system is telling you that rails isn't installed. One thing about rvm is that it relies on some complicated bash shell scripting and you sometimes need to start a fresh shell for changes to appear. You should also make sure that the correct rvm shell commands were added to your .zshrc file. Also check your path to make sure the ~/.rvm/gems/... path in included.

Lentic answered 17/10, 2011 at 3:6 Comment(2)
This was it for me, just needed to back out of the folder and back in to get rails console to pickup again. Problem with leaving terminal windows open for days...Surfboat
This was it for me also. Never thought to close out the terminal window and re-open. Once I did that after I upgraded Ruby, everything worked as expected.Creamery
S
9

I ran into this issue using rbenv. Turns out gem install rails did in fact install Rails but rails was not recognized as an executable. The fix for me was to run rbenv rehash.

I found this fix and more details on setting up Rails 5 at https://gorails.com/setup/osx/10.11-el-capitan

Sunsunbaked answered 29/7, 2016 at 3:43 Comment(1)
For me, I did rmv after already having rbenv and Rails working. It broke everything including cd, bundle, and rails, and now I literally can't even right click with my trackpad on mac. Fun times.Forrestforrester
A
8

I have encountered this problem, but it has been resolved. I use macOS, I do not use rvm, I only use HomeBrew, I first use gem env to get the installation directory of all gems, mine is:

$ gem env
RubyGems Environment:
   -RUBYGEMS VERSION: 3.1.2
   -RUBY VERSION: 2.7.1 (2020-03-31 patchlevel 83) [x86_64-darwin19]
   -INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.7.0
   -USER INSTALLATION DIRECTORY: /Users/myname/.gem/ruby/2.7.0
...

Then you try to go to /usr/local/lib/ruby/gems/2.7.0 to find the executable file directory of the rails gem that you have installed, for example: /usr/local/lib/ruby/gems/2.7.0/bin, then add to the path environment variable

Agreeable answered 26/5, 2020 at 13:50 Comment(1)
I had to add this to the .zshrc file. # Ruby setup. export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH" export LDFLAGS="-L/usr/local/opt/ruby/lib" export CPPFLAGS="-I/usr/local/opt/ruby/include" export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"Lepage
C
7

I found this problem but the solutions above didn't solve it. I am not using rvm (and I'm working on mac) and I had to update the path to add rails executable directory:

echo 'export PATH="/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"' >> ~/.zshrc
Chadbourne answered 26/12, 2021 at 11:27 Comment(0)
H
4

I had a similar issue, but with rbenv.

I originally installed ruby on bash. Then I played around with .bashrc in VIM, messed that file up, and reset it back to default. In doing so, I unknowingly removed the exported rbenv $PATH. Because of this, my terminal no longer recognized that I had ruby installed.

I revisited the ruby installation page (https://gorails.com/setup/ubuntu/15.04) and tried to set up my rbenv path again with this command:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

It failed.

Luckily, I had already switched to zsh (with oh-my-zsh) between the time I messed up my .bashrc and the time I tried to access irb from my terminal.

My solution was to set up the rbenv path per the installation guide, but by replacing all instances of .bashrc with .zshrc like so:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc

Hope this helps!

Heydon answered 29/9, 2015 at 3:4 Comment(0)
T
1

Here's what I've done. And the problem is gone. Hence I guess problem solved.

rvm use system

change to the system ruby. remove all gems in it using the command provided and explained here. then I install wanted ruby versions from scratch:

rvm install 1.8.7
rvm install rails -v 3.0.7

then bundle install

for further detail, might need dig into the gem install procedure.

Temperamental answered 18/10, 2011 at 8:10 Comment(0)
C
1

add source ~/.rvm/scripts/rvm to your .bashrc file if rails installs fine but then you get the error "rails is not currently installed". This frustrated me for a while but I found the answer here: http://www.codelearn.org/blog/how-to-install-ruby-rails-screencasts-linux-mac-windows

Corporation answered 11/11, 2013 at 18:15 Comment(0)
H
1

I just reloaded my terminal

source ~/.bashrc

See: How do I reload .bashrc without logging out and back in?

Hege answered 12/2, 2014 at 7:56 Comment(0)
I
1

Rbenv users

I had the same issue and this worked for me.

Setting the ruby version in the current directory.

rbenv local 2.7.1

Then I was able to run rails new

Inwrought answered 3/5, 2021 at 22:27 Comment(0)
D
1

For me ( MacOS Monterey, rbenv) adding rails version to gem install command get the problem resolved.

you can find a specific version of rails that matches to your ruby from this link and replace the VERSION .

gem install rails -v VERSION
rbenv rehash 

after successful installation, then rails should be added to /Users/your_user/.rbenv/shims

Also plz check that your shims directory should be the first element of your path.

➜  ~ echo $PATH # 
/Users/ario/.rbenv/shims: ...
Donoho answered 1/2, 2022 at 6:27 Comment(0)
C
0

I had the same problem but the solution above didn't help.

This was my scenario

rvm list

=> ree-1.8.7-2012.02 [ i686 ]
   ruby-1.9.3-p125 [ x86_64 ]

which ruby
  /Users/dev/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby
which rails
  /usr/bin/rails
gem list --local
  ..
  rails (3.2.8)
  rails2_asset_pipeline (0.1.20)
  railties (3.2.8)
  ..

rvm use ruby-1.9.3-p125
which ruby
  /Users/dev/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
which rails
  /Users/dev/.rvm/gems/ruby-1.9.3-p125/bin/rails

By uninstalling rails and railties and reinstalling rails when using ree my problem was resolved.

Hope this helps others in my situation, not sure how I got into it :S

Cobbler answered 9/10, 2012 at 1:13 Comment(0)
S
0

I had the same problem, I ended up deleting my .rvmrc rvm --create --rvmrc 1.8.7@project where the 1.8.7@project is whatever you want your ruby to be. cded in and out and it worked. http://sirupsen.com/get-started-right-with-rvm/

Sharma answered 29/5, 2013 at 21:56 Comment(0)
L
0

Just had same problem and couldn't find an answer. Here's what I did:

find current rails path

$ which rails

returns something like this: /usr/local/rails

Delete current version:

$ sudo rm -rf /usr/local/rails 

Reinstall rails

$ sudo gem install rails
Layla answered 23/3, 2014 at 14:53 Comment(1)
DONT do this for Mac OSMonocot
T
0

I ran into this same issue and none of the answers given helped so I thought I'd share my solution in case it might be useful for someone else.

I was messing around with my .profile and .bashrc files and along the way I messed up my RVM install. Still not sure exactly what I did, but the fix was easy. Just had to run the following command, which cleans up all of your system path settings for RVM:

rvm get [head|stable] --auto-dotfiles

Note that if you're running an old version of RVM this may upgrade your setup, which may not be what you want.

Tuttle answered 6/4, 2014 at 0:14 Comment(0)
B
0

A possible solution is to not maintain two different configuration files .bash_profile and .bashrc

The solution as suggested in this excellent post on the difference between .bash_profile and .bashrc is to source .bashrc from your .bash_profile file, then putting PATH and common settings in .bashrc.

Quoting,

add the following lines to .bash_profile:

if [ -f ~/.bashrc ]; then source ~/.bashrc fi

end quote

Brnaba answered 12/12, 2014 at 7:40 Comment(0)
L
0

I had this error after updating ruby. I had to run 'bundle install' to fix it.

Lunik answered 7/10, 2015 at 15:34 Comment(0)
F
0

Try to specify gemset explicitely in your Gemfile:

source 'https://rubygems.org'
ruby "2.2.3"
#ruby-gemset=rails424
Frenchy answered 28/10, 2015 at 8:32 Comment(0)
W
0

Try This:

You need to change your terminal emulator preferences to allow login shell.

Sometimes it is required to use /bin/bash --login as the command.

$ bin/bash --login
$ rails -v
When answered 2/7, 2016 at 14:29 Comment(0)
S
0

I had this message on my Mac:

Rails is not currently installed on this system. To get the latest version, simply type:

and it was about the $PATH not being correct. The system has an outdated version of rails (/usr/bin/ruby). The path to your chosen version of ruby ($HOME/.rbenv/versions/2.3.0/bin) must precede the system's outdated version along $PATH var, like below:

export PATH="$HOME/.rbenv/versions/2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"

adjust it to your version of ruby.

Syrian answered 6/9, 2016 at 2:22 Comment(0)
N
0

For MacOS (High Sierra):

Tokaido is the Rails installer system recommended on the "Getting Started" Rails guide page for Mac OS. But it doesn't just install, it runs its own shell scripts. If you start out using that, which sources its own shell environment, then later start a terminal without launching from the Tokaido shell, this happens, because the "rails" command falls back to the original system rails code on the Mac.

For mine, the 'which rails' command in a normal terminal returns

/usr/bin/rails

But after launching Tokaido's shell, 'which rails' gives this path:

/Users/charlesross/.tokaido/Gems/2.2.0/bin/rails
Novena answered 13/7, 2018 at 21:48 Comment(0)
V
0

Out of nowhere Rails wasn't currently installed but, what fixed it was rvm use ruby-2.6.0

...and verified my path in .bash_profile export PATH="$PATH:$HOME/.rvm/bin"

Vibrations answered 27/6, 2019 at 22:27 Comment(0)
C
0

I was having this problem today. I haven't 100% solved it, but in new tabs I can do rvm use 2.5.5 and then rails -v works fine.

➜  my-repo git:(next_release) ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-darwin18]
➜  my-repo git:(next_release) rails -v
Rails is not currently installed on this system. To get the latest version, simply type:

    $ sudo gem install rails

You can then rerun your "rails" command.
➜  my-repo git:(next_release) rvm use 2.5.5
Using /Users/amberwilkie/.rvm/gems/ruby-2.5.5
➜  my-repo git:(next_release) rails -v
Could not find rake-12.3.3 in any of the sources
Run `bundle install` to install missing gems.
➜  my-repo git:(next_release) bundle install
Cluff answered 15/8, 2019 at 15:10 Comment(0)
B
0

I was looking through the source and found another error message that suggested the user run the following command.

I ran the command and everything now works. None of the suggestions above worked for me. Run the command from inside your newly created Rails app.

gem pristine --all
Bandy answered 22/9, 2020 at 11:32 Comment(0)
W
0

Here is how it worked for me:

  1. Intall rvm in mac by following the mac installation instruction

  2. rvm install ruby

  3. gem install rails

  4. rails --version

Whall answered 22/12, 2021 at 1:53 Comment(0)
C
0

I was following along with the Odin Project ruby-on-rails course by

  • installing rbenv,

  • adding eval "$(rbenv init -)" to ~/.zshrc

  • installing rails gem

  • attempting to run rails new my_first_rails_app

But I had forgot to run source ~/.zshrc after editing the file, so I was seeing the error:

Rails is not currently installed on this system.

Competitor answered 10/6, 2022 at 12:16 Comment(0)
E
0

For rvm users

you also need to create gemset:

you have have cloned the project, ran bundle install and when you try rails s and you still get

Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

You can then rerun your "rails" command.

then try

rvm gemset create <you gemset name>
rvm use gemset <newly created gemset>
bundle install
rails s 

Also make sure you are correct version of ruby before creating the gemset To do this type rvm list

 * ruby-2.3.4 [ x86_64 ]
   ruby-2.5.3 [ x86_64 ]
   ruby-2.6.0 [ x86_64 ]
=> ruby-3.2.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

The current version being used should have a asterisk before it, like above.

Edmondo answered 9/4, 2023 at 7:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.