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

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).

Related

Cannot find rvm.sh in /etc/profile.d/

I am new to RVM and looking to use it as I deploy my Rails app to a Digital Ocean server. I am following this tutorial and trying to get my Mina script to run (similar to Capistrano). The script includes a set up section with these lines:
source /etc/profile.d/rvm.sh
rvm use || exit 1
Unfortunately, rvm.sh does not exist in /etc/profile.d (or anywhere else on my server). rvm seems to be installed just fine (I can set list rubies, set my Ruby default version, etc). I'm not even sure what rvm.sh would contain if it existed.
Thanks in advance for any help or suggestions you can provide.
#mpapis got me on the right path here. I had installed rvm under one user, but not for this user. I wound up uninstalling rvm and starting from scratch, installing rvm for multiple users.

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.

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.

Change back to bash from zsh? OSX Lion

I am trying to setup my computer for Ruby on Rails development. All new to this.
Though I have had some problems with my Rails installation and want to reset everything and start again on setting it up.
The problem I get now is installing and using bash in Terminal except of the installed zsh.
I´m trying the command ➜ ~ rvm install 1.9.2
but only get:
zsh: correct 'rvm' to 'rvim' [nyae]?
which opens the file in an texteditor.
Isn´t it supposed to be a downloadable file, which should be installed automaticly ?
It sounds like rvm is not on your path. You could specify the executable location explicitly:
~/.rvm/rvm install 1.9.2
(or maybe /usr/local/rvm/rvm depending on where you installed it)

Installing Ruby on Mac 1.9.2, still getting 1.8.7 even though path changed

I'm on a Mac running 10.6.4 Snow Leopard, and apparently ruby comes ready to go. But I'm new to Ruby, trying to learn the Rails framework, and so i decided to install the latest version 1.9.2. I followed the instructions here, but after I compile and install, when I run ruby -v I'm still getting 1.8.7. Anyone can help a noob out?
When I use which ruby I am getting usr/local/bin/ruby, so the path has changed and is correct.
UPDATE:
It seems I was having issues because I was using two login files to set my path (.bash_login and .profile). You can only use one, and the first one that exists and is readable will be used. I eventually switched to RVM and used .bash_login to load RVM into shell.
Well, the sw isn't lying to you. So something is not as you expect.
Try /usr/local/bin/ruby -v and see what version it is.
Added: Also, try locate ruby|more to see where the ruby files are on your system.
You may need to change your path to use your newly installed copy of ruby.
Added more: did you add the Path to your ~/.profile file as the instructions tell you to do in step 1?
Did you restart your terminal session after changing the ~/.profile file? (Quit and restart terminal.)

Resources