Rails commands only work on one terminal
I installed Ruby and then RVM, and then configured Rails.
It all works when I call it from the original terminal. But when I try to call various commands from new terminals, the system just gives an error message such as this one:
$rails server
The program 'rails' is currently not instal开发者_JS百科led. You can install it by typing:
sudo apt-get install rails
Why does that happen? Is there some global variable which needs to be set? I am using Ubuntu by the way.
Example of how/where gems are installed:
rvm use 1.8.7
ruby -v # 1.8.7 returned
rvm gemdir # some directory returned
gem install rails # (installed to the directory returned by `rvm gemdir` in 1.8.7)
rails -v # some version returned
rvm use 1.9.2
ruby -v # 1.9.2 returned
rvm gemdir # some directory returned
rails -v # Error if not installed, else version is shown
gem install rails # (installed to the directory returned by `rvm gemdir` in 1.9.2)
rails -v # some version returned
Now, the Rails gem is now installed in 2 directories (1 for each of the Ruby versions)
Now in order to set a default version of Ruby (instead of typing rvm use
every time you open a terminal), you can run:
rvm use 1.9.2 --default
See the documentation for more information about default.
Some other commands:
- Default ruby
rvm list default
- All Rubies:
rvm list
Also note do not use sudo
with RVM!
Hope that clears things up!
It's also important to note that gnome terminal needs to have access to the login shell. This can be configured on Ubuntu 12.04 by right-clicking on your terminal pane, clicking Profiles > Profile Preferences selecting the Title and Command pane and toggling the option Run command as login shell
.
Source: RVM + Gnome Terminal
After setting rvm default,
bash --login
did the trick for me.
i solve this problem configuring the terminal on ubuntu to 'Run command as login shell'
follow this simple tutorial
https://rvm.io/integration/gnome-terminal
精彩评论