I have the multi-user version of RVM installed in /usr/local/rvm/bin
on Ubuntu 12.10. When I upgraded Ruby from 1.9.3 to 2.0.0 this seems to have caused the following error message to pop up whenever I execute rvm version
or similar commands:
$ rvm version
Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.0.0-p247/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p247'.
rvm 1.22.16 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
I have tried the suggestions listed in similar questions, but rvm get head
and rvm get head --auto-dotfiles
did not help.
I have the following at the very end of my .bashrc
:
PATH=$PATH:/usr/local/rvm/bin # Add RVM to PATH for scripting
And my path is:
$ echo $PATH
./bin:/usr/local/sbin:/usr/local/bin:/usr/local/rvm/gems/ruby-2.0.0-p247/bin:/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p247/bin:/usr/local/rvm/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
$ which rvm
/usr/local/rvm/bin/rvm
$ which ruby
/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
RVM and PATH
RVM expects to find its bin directory first in your PATH. RVM really, really wants to ensure that it takes precedence over any system binaries or gems. To make a system install of RVM happy, your PATH statement should look similar to:
whereas you currently have that inverted. This is generally The Right Thing™ to do.
Ignoring the Error
If you really know what you're doing, you can add:
to your /etc/rvmrc or ~/.rvmrc file. This will prevent RVM from complaining about not being first in the PATH, but is very likely to cause problems for most people.
There may be legitimate edge cases where this is necessary, such as having Ruby-related wrapper scripts in ~/bin that you want to take precedence. However, debugging Ruby and RVM will be much harder, so you should remember to check
which -a <ruby|gem>
as your first troubleshooting step if you have this option enabled.Your
PATH
includes./bin:/usr/local/sbin:/usr/local/bin
on beginning, as much as I can agree that it is good to keep/usr/local/sbin:/usr/local/bin
on the beginning I need to warn you it is extremely dangerous to keep./bin
at the first place, it is like begging to hijack your computer, this is one of the biggest security issues regarding to distributed work and working with pubic repositories.Otherwise the answer form @CodeGnome is pretty accurate except this small detail.
I've found that it's
/etc/profile.d/rvm.sh
that seems to be causing the problem. Link to its content: https://gist.github.com/armhold/6832283.If I chmod it to remove read/execute bits I find that rvm is happy again.
I wonder if there is not an update to this script that should be manually installed...