should I chmod gem writable directories?

I am new to Solaris and new to Ruby. When I install some gem file
using
gem install, I get this warning. I'd like to make these gems available
globally:

bash-3.00$ gem install thor
WARNING: Installing to ~/.gem since /opt/coolstack/lib/ruby/gems/1.8
and
          /opt/coolstack/bin aren't both writable.
/opt/coolstack/lib/ruby/site_ruby/1.8/rubygems/installer.rb:149:
warning: Insecure world writable dir /opt/coolstack/lib/ruby in PATH,
mode 040777

Should I just chmod 777 /opt/coolstack/lib/ruby/gems/1.8 /opt/
coolstack/bin

or should I do something else?

It doesn't really matter and primarily depends on your execution
environment. If you `sudo gem install ...` it will put them in the
system gem directory, if you are installing them as a user, it will
give you that error and create a .gem directory in your home
directory. What's important is that the gems are available to the user
that the app will run under, though if you use the environment.rb
method (typically "config.gem ..."), you can install all of the gems
to that user's environment upon deployment via rake gems:install.

At any rate, you should never have to use a mode of 777. If you think
you do, you're likely Doing It Wrong.

-eric

Thanks, Eric, for great response. The problem with doing "sudo gem
install" is that I think env variables such as "PATH" are not passed
when you do sudo. So, gems might give some errors.

I am not familiar with environment.rb method. Could you explain or
give me a link about this? I'd like gems to be globally available to
all ruby/rails users.

Thanks.

Thanks, Eric, for great response. The problem with doing "sudo gem
install" is that I think env variables such as "PATH" are not passed
when you do sudo. So, gems might give some errors.

I am not familiar with environment.rb method. Could you explain or
give me a link about this? I'd like gems to be globally available to
all ruby/rails users.

I don't know about Solaris but on Ubuntu sudo gem install is the way to do it.

Colin

Thanks for your message. In Solaris, sudo doesn't pass PATH info to
the command.
http://ruby-oci8.rubyforge.org/en/InstallForInstantClient.html
(scroll down to end of the page and you'll see :
ruby-oci8 try to get the Instant Client location from library search
path.
note: If you use sudo, use it only when running 'make install'. sudo
doesn't pass library search path to the executing command for security
reasons

So, what should I do to make sure gems are installed and available
globally?

Also, another question: I was trying to do a rake db:migrate but I got
errors. Like this:

Any ideas?