Warning from RVM on upgrading Rubies - ruby

I'm trying to upgrade ruby on my system (OSX 10.9) via RVM. As I am starting the upgrade process via: RVM upgrade, I receive the following warning:
Warning! PATH is not properly set up, '/Users/compname/.rvm/gems/ruby-2.0.0-p0/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-p0'.
This warning makes me think my dot files are not properly configured.
How can I correct this warning?

It looks like you need to add '/Users/compname/.rvm/gems/ruby-2.0.0-p0/bin' to the beginning of your $PATH environment variable :)
To do this (for your user profile only), add the following lines to ~/.bash_profile:
PATH=/Users/compname/.rvm/gems/ruby-2.0.0-p0/bin:$PATH
export PATH

Related

RVM trying to load old Ruby version

UPDATE: I just quit all instances of Terminal and opened a new window, and apparently the message is not showing anymore.
I uninstalled ruby-2.1.0, installed ruby-2.1.3 and made it the default with RVM on Mac OS X.
Now everytime I open a new terminal window I see this:
ruby-2.1.0 is not installed.
To install do: 'rvm install ruby-2.1.0'
I looked on .bashrc, .bash_profile, .profile and .rvmrc, but I don't see anything trying to use ruby-2.1.0. I also updated the .ruby-version files.
rvm list shows ruby-2.1.3 as the current and default ruby.
How do I stop that message from appearing?
When you go into a Rails project directory in your terminal, RVM looks up the .ruby-version file and if it finds it, it checks the Ruby version specified inside this file, then if that Ruby version is not installed on your system by RVM, it gives you the message you are getting.
This is actually very helpful, allowing to know your project is using a Ruby version which is not installed on your system
The solution for me was to just quit all instances of Terminal and reopen it.
If anyone else is having this problem, check also Ali's answer regarding the .ruby-version file.

Warning! PATH is not properly set up, usually this is caused by shell initialization files

Whenever I go to a folder with a .rvmrc file, there is a warning:
Warning! PATH is not properly set up, '/home/me/.rvm/gems/ruby-2.0.0-p247/bin' is not available,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
to fix run: 'rvm use ruby-2.0.0-p247'.
I did rvm use ruby-2.0.0-p247, but the warning is still present.
Note: There are no errors, Im able to run my application just fine, but the warning is very annoying. Any ideas?
I was getting the same warning even after upgrading RVM to version 1.25.16. I was able to fix the warning by running:
rvm reset
Then when I ran:
rvm version
I did not receive the error anymore.
If you know what you're doing, and your PATH is set to what you want, you can suppress this message by putting the following in your ~/.rvmrc:
rvm_silence_path_mismatch_check_flag=1
This is handy if you use other path-manipulating programs like virtualenv, or if you just want to prefix your path with ~/bin or something.
I was able to get rid of this by doing
rvm get head
This was a bug and was handled with https://github.com/wayneeseguin/rvm/issues/2050 and was released as rvm stable 1.21.15 at 2013-07-29 19:15:30 -0700
I had the same problem too, and rvm get head didn't work for me, finally it was solved by running rvm get head --auto-dotfiles, then restarted the terminal and the annoying warning message disappeared! And the solution is found here: https://github.com/wayneeseguin/rvm/issues/2074
Hope this will help.
rvm get stable solved this for me
(as pointed out in comments on another answer by AndrewMarshall)
Okay, so I ran an export PATH command without realizing the implications and ran into the identical error, but I also lost all control of my typical commands like cd and pwd. I didn't want to reset the rvm tools I'd already installed per some of the answers above.
First attempt was to some sort of mac default path (found on google):
$ export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
Which actually solved my first problem of not having access to my typical command line tools, but was still getting the same error as #Santosh's initial problem. The next thing I did was navigate to my directory where I've set up rvm to start, and then to run a new export command as follows:
$ export PATH="$PATH"
This was how I initially set up rvm, and no more errors. Hope this helps someone
Make sure that you add the following at the end of your
~/.bash_profile OR ~/.zshrc file.
In this example our ruby version is ruby-2.6.1. Replace this with your ruby version.
export PATH=~/.rvm/gems/ruby-2.6.1/bin:$PATH
# RVM manual script for loading rvm to shell
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
This works for me.
Solved!
Warning! PATH is not properly set up, '/home/vaibhav/.rvm/gems/ruby-2.3.1/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.3.1'.
rvm get stable --auto-dotfiles
Next you might get below Error:
RVM is not a function, selecting rubies with ‘rvm use …’ will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use /bin/bash --login as the command.
Temporarily solution
I solved it temporarily by running source ~/.rvm/scripts/rvm it is the only solution it worked for me. but you have to run it every time you close the terminal. at least solves your emergency

Unable to create rvmrc, RVM is not a function, selecting rubies with 'rvm use ...' will not work

alex#ubuntu:~/Documents/ruby_projects/my_project$ rvm --create --rvmrc 1.9.3#my_project
this one gives me
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
Why am I unable to create rvmrc this way?
It could be you've corrupted your rvm installation somehow. It may be possible to fix it by wrecking around in the various shell script files it incorporates, but the easiest way to cure that problem is to re-install it.
If re-installing on top of your existing install doesn't work, try removing it completely before installing with:
rvm implode
It's usually best to create a new shell after it's been destroyed in order to start with a clean-slate. RVM has all kinds of hooks that can persist in any existing shells even after it's been imploded.
You need to read the message and follow the instructions.
A basic use of rvm is to:
rvm [use] <ruby-version>
where omitting the use keyword is still meaning to use a ruby but will not display a message.

How do I specify the order of "default" rvms?

I have RVM installed, with project rvmrc files enabled.
In my bashrc I have:
rvm use 1.9.2
However, in one of my project rvmrc files I have:
rvm use 1.8.7
Which works great, however if I open up a new terminal window within the project I get:
Using /home/.../.rvm/gems/ruby-1.8.7-p352
Using /home/.../.rvm/gems/ruby-1.9.2-p290
Obviously, I want to 1.8.7, but the bashrc gets run after the project rvmrc. Meaning I'm using the wrong rvm so either have to cd out and back into the directory or run rvm use 1.8.7 again.
Is there anyway to force the rvmrc file to run after the bashrc?
I know about rvm default, but not sure if I want to\can use this.
please read this: https://rvm.beginrescueend.com/support/faq/#shell_login it describes which files should be used in which use cases.
as for rvm --default 1.9.2 it should be used over manually entering version into your rc file as it is loading ruby only if one was not yet selected.
Simplest solution for your rc files problem (I guess you have one) would be rvm get head --auto which will reorganize sourcing rvm in your rc files - to make it fully functional you need to restart your graphical session (or just reboot computer).

Ruby: RVM Install Error "Could not source..."

A reinstall of RVM produced the following errors when done:
WARNING:
Could not source '/Users/developer/.rvm/scripts/base' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/version' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/selector' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/cd' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/cli' as file does not exist.
RVM will likely not work as expected.
WARNING:
Could not source '/Users/developer/.rvm/scripts/override_gem' as file does not exist.
RVM will likely not work as expected.
cat: /Users/developer/.rvm/VERSION: No such file or directory
/Users/developer/.rvm/src/rvm/scripts/rvm: line 133: __rvm_conditionally_add_bin_path: command not found
I reinstalled after I wrestled with trying to get RVM to work with Textmate and RVM behavior became strange (reporting it didn't have gemsets it would list) so I ran:
rvm implode
... and then manually removed the executable. Then I ran the install again by scrupulously following the single user instructions from the home site.
After I spotted the errors, I investigated the paths and found that many files in ~/.rvm/scripts/ and ~/.rvm/src/rvm/scripts/ which obviously should be executable did not have execute permissions.
RVM would not run at all so I set the executable bit on all the files in the two directories and that seems to have fixed things. (So far at least.)
Googling, it seems that other people have hit this problem but there seems to be no explanation or resolution. I would like to find out if this is a known issue and whether I should reinstall yet again.
I'm running rvm 1.6.9 on MacOS X 10.6.7
Yep. If you have installed system-wide it is definitely looking for both the system-wide configuration... and some hard-coded user scripts. Which is weird.
quick fix:
ln -nfs /usr/local/rvm /Users/developer/.rvm
it looks like all you need is to create that missing file.
in your terminal type:
touch /Users/developer/.rvm/scripts/version
touch /Users/developer/.rvm/scripts/base
they are warnings, not errors. I've got similar ones on my ubuntu linux box (but not on another, with same RVM version). so, it's not strctly related to OSX.
your RVM installation should work anyway.

Resources