How to use RVM --default on MacOSX
I had the same problem once. It turned out the rvm-script got loaded twice, which broke things a bit.
Check all the files that load when you open a shell:
/etc/profile
~/.bashrc
~/.bash_profile
and so on, and make sure they don't load RVM twice.
Maybe put
echo "Going to load RVM"
before
[[ -s "/Users/user/.rvm/scripts/rvm" ]] && source "/Users/user/.rvm/scripts/rvm"
in your ~/.bash_profile
to see if it happens or not.
How do I set a default Ruby version using RVM?
You can install whichever version you like, for example rvm install ruby-1.9.3-p392
. Then you can make this the default by using rvm use --default ruby-1.9.3-p392
. You must install
before you can use
.
See the cheat sheet for a brief overview or consult the comprehensive documentation indexed at the bottom of the page here: https://rvm.io/
Your second question regarding MySQL should be filed separately (chances are you haven't yet started the MySQL server).
how to set default ruby with rvm
Typing rvm list
will give you a list of the installed rubies you have, like this:
ree-1.8.7-2010.02 [ i686 ]
ruby-1.8.7-p249 [ i686 ]
ruby-1.9.2-p180 [ x86_64 ]
ruby-1.9.2-p180-patched [ x86_64 ]
ruby-1.9.2-p290 [ x86_64 ]
ruby-1.9.2-p290-webkit [ x86_64 ]
=* ruby-1.9.3-p194 [ x86_64 ]
If the one you want is ruby-1.9.3-p194
, then type:
rvm --default use ruby-1.9.3-p194
First, be careful to follow the installation instructions closely and make sure it's working.
You should also see this line in your bashrc as well:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Then try opening a new shell or try typing:
source ~/.rvm/scripts/rvm
But in general if you're having issues, I'd recommend just re-installing rvm -- it doesn't take long and it's easy:
curl -L get.rvm.io | bash -s stable
How to set default ruby version using rvm
My default doesn't always correctly set either, so I've put a .rvmrc in the directory my terminal opens at (or in dirs my terminal is likely to open at) with rvm use default
inside.
RVM default ruby not used when opening terminal
Problem could be solved by rebooting system, although I don't know why this works
Why do I need to use rvm use default after opening new terminal window?
Zabba is right in the comments when he says the correct command to use is rvm use 1.9.2 --default
.
RVM considers default
to be a Ruby, equivalent to the Ruby set to the default. If I type rvm use default
into my terminal, I get this output:
$ rvm use default
Using /Users/tom/.rvm/gems/ruby-1.9.3-p0
However, there is the ability to list multiple Rubies in your call to rvm use
, e.g:
$ rvm use 1.9.3 system
Now using system ruby.
$ rvm use system 1.9.3
Using /Users/tom/.rvm/gems/ruby-1.9.3-p0
Although I am not entirely sure whether this is a feature (or the particular use case for passing multiple Rubies since RVM doesn't appear to fall back on the other listed Ruby if the last one isn't installed), it means that when you type rvm use default 1.9.2
, rather than setting the default to 1.9.2, you are telling RVM to use 1.9.2, since it is the last Ruby listed in the command.
If you run the command rvm use 1.9.2 --default
once, you will then be using 1.9.2 in every terminal you open.
NB on the multiple-arguments-to-rvm-use-feature: I know that you can pass multiple Rubies to the RVM command to run a script with multiple versions of Ruby but I can't see RVM setting two versions of Ruby to run at once.
Related Topics
Convert Time from One Time Zone to Another in Rails
No Such File to Load - Readline
How to Create a Sha1 Hash in Ruby
How to Remove Lines of Data in the Middle of a Text File with Ruby
What Other Languages Have Features And/Or Libraries Similar to Perl's Format
Rails: Is There a Rails Trick to Adding Commas to Large Numbers
"Rake Assets:Precompile" Gives Punc Error
Installing Nokogiri on Osx 10.10 Yosemite
Difference Between Ruby and Ruby on Rails
Ruby on Rails Best Practices - Big Controller VS Small Controller
How to Get Rid of Non-Ascii Characters in Ruby
How to Create a Private Class Method
Rvm 'Not Found' After Successful Usage and a Few Days Later