alec@Locke:~/workspace/rails/nwis$ rails -v
Rails 3.0.7
alec@Locke:~/workspace/rails/nwis$ sudo rails -v
sudo: rails: command not found
I need to use sudo because I have a permission denied error when I try to run rails server on my machine.
I think it's an issue with RVM and using Gemsets, but I don't know why. I've tried re-running the Gemset setup process using sudo for each command to make sure my root user and my regular user are on the same page, but that gave me the same result.
To be clear as to why I am running as sudo; when trying to start a rails server, this is what happens:
rails server
=> Booting WEBrick
=> Rails 3.0.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/alec/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:267:in `initialize': Permission denied - /home/alec/workspace/rails/nwis/tmp/pids/server.pid (Errno::EACCES)
from /home/alec/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:267:in `open'
from /home/alec/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:267:in `write_pid'
from /home/alec/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.2/lib/rack/server.rb:203:in `start'
from /home/alec/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands/server.rb:65:in `start'
from /home/alec/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/alec/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /home/alec/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'`