Lots of confusion and difficulty related to gem installation. My gem environment:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10]
- INSTALLATION DIRECTORY: /opt/local/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /opt/local/bin/ruby
- EXECUTABLE DIRECTORY: /opt/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-10
- GEM PATHS:
- /opt/local/lib/ruby/gems/1.8
- /Users/apple/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/"]
- REMOTE SOURCES:
- http://gems.rubyforge.org/
The problem is one where I will add (eg) to environment.rb :
config.gem 'authlogic'
All good, now when I run
gem install authlogic
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /opt/local/lib/ruby/gems/1.8 directory.
running it with sudo is fine :
Dans-iMac-335:authlogic apple$ sudo rake gems:install
Password:
(in /Users/apple/Documents/projects/authlogic)
gem install authlogic
Successfully installed authlogic-2.1.6
1 gem installed
Installing ri documentation for authlogic-2.1.6...
Installing RDoc documentation for authlogic-2.1.6...
but running rake tasks throws an error :
Dans-iMac-335:authlogic apple$ rake db:migrate
(in /Users/apple/Documents/projects/authlogic)
Missing these required gems:
authlogic
You're running:
ruby 1.8.7.174 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
rubygems 1.3.5 at /Users/apple/.gem/ruby/1.8, /Library/Ruby/Gems/1.8, /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
Run `rake gems:install` to install the missing gems.
I can't see what the problem is. And I'm going out of my mind. The directory at the 'other' gems location :
Dans-iMac-335:authlogic apple$ ls /Users/apple/.gem/ruby/1.8/gems
actionmailer-2.2.2 activeresource-2.2.2 aws-s3-0.6.2 mysql-2.8.1 rails-2.2.2 xml-simple-1.0.12
actionpack-2.2.2 activeresource-2.3.3 builder-2.1.2 packet-0.1.15 rake-0.8.7
actionwebservice-1.2.3 activesupport-2.2.2 chronic-0.2.3 pg-0.8.0 rest-client-1.3.1
activerecord-2.2.2 activesupport-2.3.3 mime-types-1.16 rack-1.0.0 sqlite3-ruby-1.0.1
activerecord-2.3.5 activesupport-2.3.5 mongrel-1.1.5 rack-1.0.1 taps-0.2.26
This, I assume, is the default OSX rails system? The first location gives the much fuller set that represents my normal environment. Since my projects depend on many of these, and they aren't present in the other directory, this is verifiably the location that gems are being pulled from in my development environment:
Dans-iMac-335:authlogic apple$ ls /opt/local/lib/ruby/gems/1.8/gems
RedCloth-4.2.3 crack-0.1.8 mime-types-1.16 rack-1.1.0 sinatra-0.9.2
actionmailer-2.3.5 daemons-1.0.10 minitest-1.4.2 radiant-0.8.1 sinatra-1.0
actionmailer-2.3.8 faker-0.3.1 mogli-0.0.14 rails-2.2.2 spree-0.10.2
actionpack-2.3.5 fastthread-1.0.7 mongrel-1.1.5 rails-2.3.5 sqlite3-ruby-1.0.1
actionpack-2.3.8 gem_plugin-0.2.3 mutter-0.5.3 rails-2.3.8 sqlite3-ruby-1.2.5
activemerchant-1.5.1 google-geocode-1.2.1 mysql-2.8.1 rc-rest-3.0.0 state_machine-0.8.0
activerecord-2.3.8 hashie-0.4.0 net-scp-1.0.2 rest-client-1.0.3 stringex-1.0.3
activerecord-tableless-0.1.0 heroku-1.10.8 net-sftp-2.0.2 rest-client-1.6.1 taps-0.2.19
activeresource-2.3.5 highline-1.5.1 net-ssh-2.0.15 rmagick-2.13.1 taps-0.3.13
activeresource-2.3.8 hoe-2.3.3 net-ssh-gateway-1.0.1 ruby-hmac-0.4.0 thor-0.9.9
activesupport-2.3.8 hpricot-0.8.1 nokogiri-1.3.3 ruby-openid-2.1.7 treetop-1.4.8
authlogic-2.1.6 httparty-0.6.1 paperclip-2.3.1.1 rubyforge-2.0.2 whenever-0.3.7
authlogic-oid-1.0.4 json-1.1.9 passenger-2.2.5 rubyforge-2.0.4 will_paginate-2.3.11
aws-s3-0.6.2 json_pure-1.1.9 pg-0.8.0 rubygems-update-1.3.5 xml-simple-1.0.12
builder-2.1.2 json_pure-1.2.4 pg-0.9.0 rubygems-update-1.3.7
capistrano-2.5.9 launchy-0.3.3 polyglot-0.3.1 searchlogic-2.3.5
cgi_multipart_eof_fix-2.5.0 less-1.2.20 postgres-0.7.9.2008.01.28 sequel-3.0.0
configuration-1.1.0 libxml-ruby-1.1.3 rack-1.0.1 sequel-3.15.0
So, if the system uses this /opt/local/lib/ruby/gems/1.8/gems directory, why can't it see it when I call rake? And what can I do about it?
I don't see what the problem is, but have you tried running "gem list " to see what gems your system recognizes as having installed?
My solution was to change the #! line of rake.rb to point to the location of the ruby installation that has the gems.
From what I learned, when you're installing gems, rails takes account of the $PATH variable, but when loading the environment when rake is called, it doesn't. So rake doesn't know about those locations. The answer, then, was to direct rake's attention to the right location.
Related
I'm getting this error whenever I run rails (or any rails command)
_rails_command:2: permission denied: bin/rails
ONLY when i'm inside some old rails app directory.
In these directories bundle exec rails c command works but rails or even rails -v don't work.
Background:
I keep my coding workspace in dropbox folder.
Now I recently installed Manjaro and hence all the rails apps which I downloaded back from my previous OS I call them old rails app.
In Short:
Rails works fine everywhere except for old rails apps.
bundle exec rails c works fine though.
Ruby versions which I've tried:
2.0.0 (rvm), 2.1.1(rvm), 2.1.1 (system)
Gem Environment :
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.0.0 (2014-02-24 patchlevel 451) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/tat/.rvm/gems/ruby-2.0.0-p451#latest
- RUBY EXECUTABLE: /home/tat/.rvm/rubies/ruby-2.0.0-p451/bin/ruby
- EXECUTABLE DIRECTORY: /home/tat/.rvm/gems/ruby-2.0.0-p451#latest/bin
- SPEC CACHE DIRECTORY: /home/tat/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/tat/.rvm/gems/ruby-2.0.0-p451#latest
- /home/tat/.rvm/gems/ruby-2.0.0-p451#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/tat/.rvm/gems/ruby-2.0.0-p451#latest/bin
- /home/tat/.rvm/gems/ruby-2.0.0-p451#global/bin
- /home/tat/.rvm/rubies/ruby-2.0.0-p451/bin
- /home/tat/bin
- /usr/local/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /usr/bin/core_perl
- /home/tat/.rvm/bin
UPDATE:
Its working fine in bash, the problem seem to be with oh-my-zsh.
Here is my rvm-info (from zsh):
ruby-2.0.0-p451#latest:
system:
uname: "Linux tat-box 3.10.37-1-MANJARO #1 SMP Mon Apr 14 20:56:29 UTC 2014 x86_64 GNU/Linux"
system: "manjaro/0.8.9/x86_64"
bash: "/usr/bin/bash => GNU bash, version 4.3.8(1)-release (x86_64-unknown-linux-gnu)"
zsh: "/usr/bin/zsh => zsh 5.0.5 (x86_64-unknown-linux-gnu)"
rvm:
version: "rvm 1.25.23 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "21 hours 33 minutes 15 seconds ago"
path: "/home/tat/.rvm"
ruby:
interpreter: "ruby"
version: "2.0.0p451"
date: "2014-02-24"
platform: "x86_64-linux"
patchlevel: "2014-02-24 revision 45167"
full_version: "ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-linux]"
homes:
gem: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest"
ruby: "/home/tat/.rvm/rubies/ruby-2.0.0-p451"
binaries:
ruby: "/home/tat/.rvm/rubies/ruby-2.0.0-p451/bin/ruby"
irb: "/home/tat/.rvm/rubies/ruby-2.0.0-p451/bin/irb"
gem: "/home/tat/.rvm/rubies/ruby-2.0.0-p451/bin/gem"
rake: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest/bin/rake"
environment:
PATH: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest/bin:/home/tat/.rvm/gems/ruby-2.0.0-p451#global/bin:/home/tat/.rvm/rubies/ruby-2.0.0-p451/bin:/home/tat/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:/home/tat/.gem/ruby/2.1.0/bin:/home/tat/.rvm/bin"
GEM_HOME: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest"
GEM_PATH: "/home/tat/.rvm/gems/ruby-2.0.0-p451#latest:/home/tat/.rvm/gems/ruby-2.0.0-p451#global"
MY_RUBY_HOME: "/home/tat/.rvm/rubies/ruby-2.0.0-p451"
IRBRC: "/home/tat/.rvm/rubies/ruby-2.0.0-p451/.irbrc"
RUBYOPT: ""
gemset: "latest"
In the directory you mentioned is your rails in executable mode. If not you can apply
chmod u+x bin/rails
and make it executable.
Run
bundle exec rake rails:update:bin
It will update bin/rails and bin/rake files.
So what worked for me, anyone coming across this issue is to run
bundle exec rake app:update:bin
You'll be given a prompt asking if you want to overwrite? The options here are:
Y - yes (default one, just press Enter for it)
n - no (leave current file without changes)
a - all (apply all changes)
q - quit
d - diff
h - help
I chose a and it seemed to work ok.
I have this when I try to use a rails 4.0 version.
So when I try to put bundle exec first, like:
bundle exec rake db:migrate
or
bundle exec rails s
work's.
I had the same issue and here's what helped me.
Open ~/.zshrc and add this
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
The solution for me was:
bundle exec rake rails:update:bin
or just use:
For new rails versions:
bundle exec rake app:update:bin
For old rails versions:
bundle exec rake rails:update:bin
I am running Apache on my Raspberry Pi (Raspbian) and struggling to get Passenger working properly with my site. When I go to visit my site (which is set up as a VirtualHost), I get the error: "cannot load such file -- bundler". The first line of the backtrace is
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb
To install Passenger, I followed the instructions here: http://www.modrails.com/documentation/Users%20guide%20Apache.html#install_on_debian_ubuntu.
In particular, I ran the command
sudo apt-get install libapache2-mod-passenger
This link says, "The Apache package provides configuration snippets for you, so you don’t need to modify any Apache configuration to get it to load Phusion Passenger". The way the installation went on my machine was that it automatically added and enabled the passenger module through the files "passenger.conf" and "passenger.load":
passenger.conf:
<IfModule mod_passenger.c>
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
</IfModule>
passenger.load:
LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so
Running "gem env" gives me the following output:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.7
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [armv6l-linux-eabihf]
- INSTALLATION DIRECTORY: /home/user/.rvm/gems/ruby-2.0.0-p247
- RUBY EXECUTABLE: /home/user/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
- EXECUTABLE DIRECTORY: /home/user/.rvm/gems/ruby-2.0.0-p247/bin
- RUBYGEMS PLATFORMS:
- ruby
- armv6l-linux
- GEM PATHS:
- /home/user/.rvm/gems/ruby-2.0.0-p247
- /home/user/.rvm/gems/ruby-2.0.0-p247#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
I tried looking all over for a mod_passenger.so file elsewhere in the file system with no luck. I am reluctant to simply reinstall rails or passenger because I am unsure what the implications will be for the modules and configuration. Any advice is appreciated, thanks!
Maybe you didn't configure your app to use Ruby 2.0.0? If you don't do that explicitly, it will use the default Ruby, which is /usr/bin/ruby. This section from the manual tells you how to specify a different Ruby: http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerRuby
Note that multiple Ruby supports requires Phusion Passenger >= 4.0.0.
The problem ended up being that I needed to set the environment variable for the GEM_PATH within a .htaccess file!
Using heroku for deployment while learning Rails with the Ruby On Rails tutorial by Michael Hartl, on Ubuntu 11.04 Natty Narwhal. I installed it using
sudo gem install heroku
and the commands seemed to run fine for that session in the terminal. The next time I went to work, I tried the command "heroku open" and I was told "heroku: command not found". Looking at some of the answers to similar problems here, it seemed the answer was to run
gem enviroment
which returned the following:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/richard/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I then ran
$ export PATH=$PATH:/var/lib/gems/1.8/bin
which seemed to fix the problem. However, the next time I tried to run heroku in the terminal, I was told "command not found" again! Running the "export PATH=$PATH" command seems to fix the problem every time, but I would rather I didn't have to run this command everytime I want to use heroku. Is there any permanent solution to the problem?
If you're using bash as your shell, then add that export line to .bash_profile in your home directory. The equivalent for zsh is .zshrc, and other shells have their own files to automatically load for every shell session.
Update and Solution
I finally got everything working after
1. Uninstalling everything ruby-related in /usr/local/... as well as uninstalling all versions of rails.
2. Installing RVM as a standard user -> i.e. installed in my home directory and NOT in /usr/local as root
3. rvm install 1.8.7 and set as default
Now everything seems to be working fine.
My conclusion after days of googling and reading about others' solutions is that Snow Leopard just doesn't handle the rails dev environment well unless you sandbox it through RVM in a local director. I resisted going to RVM because I don't have a need to manage multiple ruby versions.
Some of the responses below along with my code excerpts on pastie may provide some helpful advice for others trying to troubleshoot. In particular from #fl00r and #Kelvin:
run which -a for gem, bundle, rails, rake, etc. to see the available versions. Check to see which versions of ruby are being called with head -1 on each.
Original Below
Pretty much at my wit's end after a few days of Googling, uninstalling, and re-installing. I'm trying to get rails running on Mac OS X 10.6.7. I followed the Hivelogic Post on this topic. Apologize for the length of this question.
Has anyone followed a step-by-step uninstall/reinstall process for getting this working? Or a link to advice on troubleshooting? Should I clean out everything following this advice from Chad Wooley and migrate to RVM?
The common theme has been errors related to being unable to find gems even though they are installed. For instance, trying to create a new rails app:
kevindewalt#new-host-4:~/Documents$ $ rails new blog
You don't have i18n installed in your application. Please add it to your Gemfile and run bundle install
Or an existing app I have running on another machine after running bundle install:
kevindewalt#new-host-4:~/Documents/ClaimAway$ (master) $ rake db:setup
(in /Users/kevindewalt/Documents/ClaimAway)
Could not find i18n-0.4.2 in any of the sources
Try running `bundle install`.
kevindewalt#new-host-4:~/Documents/ClaimAway$ (master) $ rails s
/usr/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0/lib/action_dispatch.rb:35:in `require': no such file to load --
-
kevindewalt#new-host-4:~/Documents$ $ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.7.2
- RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.7.0]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-10
- GEM PATHS:
- /usr/local/lib/ruby/gems/1.8
- /Users/kevindewalt/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
-
kevindewalt#new-host-4:~/Documents$ $ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/usr/local/git/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
-
kevindewalt#new-host-4:~/Documents$ $ which -a ruby
/usr/local/bin/ruby
/usr/local/bin/ruby
/usr/bin/ruby
/usr/local/bin/ruby
add to Gemfile
gem 'i18n'
Actually you should specify exact version also:
gem 'i18n', '0.4.2'
then run bundle install. But as far your i18n gem will be locked try this:
bundle update i18n
That is all what is written in your error.
rvm is probably your best bet to prevent problems like this. But it might be overkill if you actually don't need multiple ruby version or gemsets.
Let me try to diagnose the issue. If we can solve it, then you don't have to jump through the rvm hoops (unless you want to of course).
I suspect that when you run some of these ruby-based scripts like 'gem', 'bundle', 'rails', and 'rake' the shebang line of these scripts is pointing to a ruby installation that you didn't expect.
Here's my usual checklist of diagnosing gem issues like this.
Run "which -a gem". Do you see multiple unique locations? If so, gem list using the full path to gem. E.g. "/usr/bin/gem list" and "/usr/local/bin/gem list". My guess is that you'll see that one of the lists has i18n and the other doesn't.
Run "which" on rails, bundler, and gem. Run "head -1" on each of those paths. Does the ruby path match in all of them?
My guess is that the "rails" in your PATH is not using the same ruby as the "gem" in your PATH. Maybe you installed it with the preinstalled 'gem' command so it's pointing to the system ruby's gem directory rather than /usr/local. Try reinstalling rails, then closing and reopening your terminal. Then use the "which" and "head -1" above to make sure "rails" is using the same ruby as "gem" is.
Another suspect is the "sudo" command. You may also want to run the "which" command via sudo, e.g. sudo sh -c 'which gem'. It's possible that sudo is running one of the preinstalled scripts.
If in doubt, you could run: "sudo /usr/local/bin/gem install rails" so you know for sure which gem command you're using.
I would do a couple of things.
Start by uninstalling Rails >= 3 from your current systems gem installation. This includes all Rails dependencies. You should be able to boot < Rails3 projects using your normal gem installation now.
Next up install rvm and use rvm to install Ruby 1.9.2 and Rails3. Use the 1.9.2 rvm to work with your Rails3 projects. Part of rails3 and rails2 don't work well together so you should always try to seperate them imho.
See this stack question for step by step instructions for installing rails using rvm. This is the most tried and true method I've found:
Uninstall Ruby on Rails on Mac OS X 10.6
Everytime I start my Rails applications I get LoadError with the following output.
On Rails 2.3.8:
no such file to load -- sqlite3/sqlite3_native
<internal:lib/rubygems/custom_require>:29:in `require'
On Rails 3.0.0:
no such file to load -- bundler
<internal:lib/rubygems/custom_require>:29:in `require'
I run the applications in the production mode on a development machine using Nginx + Passenger.
What is the reason of this issue? How can I solve it?
Thanks.
Debian GNU/Linux 5.0.6;
Ruby 1.9.2;
Rubygems 1.3.7;
Ruby on Rails 2.3.8, 3.0.0;
Nginx 0.8.50;
Passenger 2.2.15;
sqlite3-ruby 1.3.1;
bundler 1.0.0.rc.6.
Updated
All of my gems is installed by the unprivileged user in the local directory /home/<usernam>/.gem. If it helps, here's the gem env output:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i686-linux]
- INSTALLATION DIRECTORY: /home/<username>/.gem
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /home/<username>/.gem/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/<username>/.gem
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- :gemhome => "/home/<username>/.gem"
- :gempath => ["/home/<username>/.gem"]
- REMOTE SOURCES:
- http://rubygems.org/
Updated
I tackled with the problem. Its source was that I defined a custom gem path. That is I added to the ~/.gemrc file the following lines:
:gemhome: /home/<username>/.gem
:gempaths:
- /home/<username>/.gem
Thus all of my gems was placed in the specified directory but not the default one. For some reason Rubygems coundn't find it there and rose an exception.
When I removed that lines from the file the default paths was set for Rubygems and after I installed all the required gems and loaded my Rails applications all began to work.
Once again, the bug conditions are:
Nginx + Passenger;
The gempath is set to /home/<unprivileged_user>/.gem in ~/.gemrc;
An init.d script is creaded and added to the boot sequence (update-rc.d nginx defaults);
System is rebooted, server is started atomaticlally;
http://localhost/my_rails_app;
LoadError; no such file to load -- <gem_name>; <internal:lib/rubygems/custom_require>:29:in `require'.
Why can't Rubygems find gems in the custom location but can find them in default? That's the question.
I too had this problem when using RVM - I must have specified a gemset or something and not made it project specific. At any rate, read this rvm guide if you want to know the basics of RVM and try to specify a new gemset for your current folder / project, install a new rails gem to that gemset, and then use that gemset. For example, to create a new gemset for rails version 2.3.8:
$ rvm gemset create rails238
$ rvm ruby-1.8.7#rails238
$ gem install rails -v 2.3.8
Then if all went according to plan type rvm gemset use [gemsetName], or do rvm gemset list to see a list of installed gemsets, and to see if rails is working fine try rails -v and you should see rails 2.3.8
Check your system to locate where your rubies and gems are installed ( you can do this by "which ruby" and "which gem"). Usually, they're installed in the same folder (/usr/bin or /usr/local). If they are in different locations, there might be load error. Just a suggestion.