0

About my environment:

FreeBSD: 9.1

I have changed my shell from csh to bash:

chsh -s /usr/local/bin/bash

Then edited my ~/.bashrc

PATH=$HOME/local/bin:$HOME/local/lib/ruby/gem/bin:$HOME/local/git/bin:$PATH

and source it.

I installed ruby by rbenv

$ rbenv install 2.0.0

After I installed rails

$ gem install rails --version 4.0.0

I can see it in my gem list

$ gem list
*** LOCAL GEMS ***

actionmailer (4.2.1, 4.0.0)
actionpack (4.2.1, 4.0.0)
actionview (4.2.1)
activejob (4.2.1)
activemodel (4.2.1, 4.0.0)
activerecord (4.2.1, 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.2.1, 4.0.0)
arel (6.0.0, 4.0.2)
bigdecimal (1.2.0)
builder (3.2.2, 3.1.4)
bundler (1.9.1)
erubis (2.7.0)
globalid (0.3.3)
hike (1.2.3)
i18n (0.7.0)
io-console (0.4.2)
json (1.7.7)
loofah (2.0.1)
mail (2.6.3, 2.5.4)
mime-types (2.4.3, 1.25.1)
mini_portile (0.6.2)
minitest (5.5.1, 4.3.2)
multi_json (1.11.0)
nokogiri (1.6.6.2)
polyglot (0.3.5)
psych (2.0.0)
rack (1.6.0, 1.5.2)
rack-test (0.6.3)
rails (4.0.0)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.6)
rails-html-sanitizer (1.0.2)
railties (4.2.1, 4.0.0)
rake (0.9.6)
rdoc (4.2.0, 4.0.0)
sprockets (2.12.3)
sprockets-rails (2.2.4, 2.0.1)
test-unit (2.0.0.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
treetop (1.4.15)
tzinfo (1.2.2, 0.3.43)

But when I type

$ rails -v

it showed me

bash: rails: command not found

And when I type

$ whereis rails

it showed me

rails:

What's wrong about it? How to find the problem?

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
Jingqiang Zhang
  • 1,039
  • 2
  • 13
  • 24
  • Did you try the running the command ina a new terminal? – Sooraj Chandu Mar 22 '15 at 09:11
  • @SoorajChandu Yes, but the result was the same. – Jingqiang Zhang Mar 22 '15 at 09:53
  • Cany you try reinstalling ruby using rvm..i found it more comfotable than rbenv..remember unistalling ruby and rbenv before you install rvm – Sooraj Chandu Mar 22 '15 at 10:51
  • @SoorajChandu Thank you for your answer. Is it the key point to solve this issue? Why can't I use rbenv? I want to know where the matter is. – Jingqiang Zhang Mar 22 '15 at 12:42
  • 1
    Maybe this related question can help: http://stackoverflow.com/questions/7788946/rails-keeps-telling-me-that-its-not-currently-installed – Michael Jaros Mar 22 '15 at 12:45
  • The only issue I see is the path you specified PATH=$HOME/local/bin:$HOME/local/lib/ruby/gem/bin:$HOME/local/git/bin:$PATH might be wrong path, everything else looks fine – Sooraj Chandu Mar 23 '15 at 03:49
  • @SoorajChandu Thank you. Today I login in my server again. This time when I run `bash` and `gem list`, it showed me a clear list! So I installed rails again and run `rbenv rehash`, it worked! I believe that there were something wrong in the system, but I can't point it out correctly. In fact, I am sure I was under the bash environment yesterday. – Jingqiang Zhang Mar 23 '15 at 12:31

0 Answers0