Should I Check in '.Ruby-Gemset' And/Or '.Ruby-Version'

Safely deleting .ruby-version and .ruby-gemset

  1. Yes, since the rvm observes the current dir for the .ruby-gemset, .ruby-version, or .rvmrc.

  2. Yes, you can, and it will lead to that rvm will not do actions required for the found out the config files. You have to just place the files into the proper folder, and touch not the gemsets themselves. i.e. it will not affect on placement of the gemset inside the rvm.

Use rvmrc or ruby-version file to set a project gemset with RVM?

If your .rvmrc file contains custom shell code, continue using .rvmrc as it allows you to include any shell code.

If your only aim is to switch Ruby versions, then use .ruby-version which is supported by other Ruby version switchers such as rbenv or chruby. This file also does not require trusting as it is just the name of a Ruby version and will not be executed in any way.

If you use .ruby-version you can include @gemset in the file but this will not be compatible with other switchers. To maintain compatibility use the gemset name in a separate file .ruby-gemset which is ignored by other tools (it works only together with .ruby-version).

For example, if you have a simple .rvmrc:

rvm use 1.9.3@my-app

It can be transformed to .ruby-version:

1.9.3

And .ruby-gemset:

my-app

Be sure to remove the .rvmrc file as it takes precedence over any other project configuration files:

rm .rvmrc

RVM not reading .ruby-gemset files when I open a new tab in my terminal

I had the same issue, and I was able to fix it. However, my exact solution might be useless for you. I had oh-my-zsh installed. It looks like during installation, it was trying to mimic my .bashrc files and it screwed PATH variable for me. Here's the line I had trouble with:

export PATH="/home/alexander/.rvm/gems/ruby-2.1.1@security/bin:/home/alexander/.rvm/gems/ruby-2.1.1@global/bin:/home/alexander/.rvm/rubies/ruby-2.1.1/bin:/home/alexander/.nvm/v0.10.25/bin:/home/alexander/work/gc-sdk/google-cloud-sdk/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/alexander/.rvm/bin"

So, you need to verify if your PATH variable isn't tempered with. And you need to let RVM configure it for you. Both these things can be done with a simple command in your terminal (assuming you have RVM installed):

rvm get stable --auto-dotfiles

Also, there're couple of issues created on GitHub. The common advice is to use command from above and switch your terminal to login shell.

Hope it helps!

Set a default Ruby version for a specific directory (RVM)

One way is to use a Gemfile and set the ruby version in it. like so:

ruby '2.2.0'

then when you enter the directory you will see the following message from rvm

RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /Users/danmanstx/rails_projects/app/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.

How can I update Ruby version 2.0.0 to the latest version in Mac OS X v10.10 (Yosemite)?

Open your terminal and run

curl -sSL https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer | bash -s stable

When this is complete, you need to restart your terminal for the rvm command to work.

Now, run rvm list known

This shows the list of versions of the Ruby interpreter.

Now, run rvm install ruby@latest to get the latest Ruby version.

If you type ruby -v in the terminal, you should see ruby X.X.X.

If it still shows you ruby 2.0., run rvm use ruby-X.X.X --default.

Prerequisites for Windows 10:

  • C compiler. You can use http://www.mingw.org/
  • make command available otherwise it will complain that "bash: make: command not found". You can install it by running mingw-get install msys-make
  • Add "C:\MinGW\msys\1.0\bin" and "C:\MinGW\bin" to your path environment variable

Rails gem update not working (version 4.1.1 to 4.2.0) as a solution to warning: circular argument reference error

Try the following :

rvm use ruby-2.2.0@rails4.2 --create
gem install rails
rails -v

This should give you rails 4.2

rbenv not changing ruby version

Check that PATH contains $HOME/.rbenv/shims and $HOME/.rbenv/bin

$ env | grep PATH

Also check that you have the following in your ~/.bash_profile if using bash or ~/.zshenv if using zsh

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

NOTE:
Make sure it's the last setting in your ~/.bash_profile . I ran into an issue where I installed a program that updated my .bash_profile and reset PATH.

Finally, make sure your $HOME folder doesn't have a .ruby-version file that you may have created by accident if you were to have done $ rbenv local <ruby-version> in your $HOME folder. Doing $ rbenv global <ruby-version> modifies the $HOME/.rbenv/version file, and the existence of a .ruby-version file in the $HOME folder would override the version set by $HOME/.rbenv/version.

From the docs:

Choosing the Ruby Version
When you execute a shim, rbenv determines which Ruby version to use by reading it from the following sources, in this order:

The RBENV_VERSION environment variable, if specified. You can use the rbenv shell command to set this environment variable in your current shell session.

The first .ruby-version file found by searching the directory of the script you are executing and each of its parent directories until reaching the root of your filesystem.

The first .ruby-version file found by searching the current working directory and each of its parent directories until reaching the root of your filesystem. You can modify the .ruby-version file in the current working directory with the rbenv local command.

The global ~/.rbenv/version file. You can modify this file using the rbenv global command. If the global version file is not present, rbenv assumes you want to use the "system" Ruby—i.e. whatever version would be run if rbenv weren't in your path.



Related Topics



Leave a reply



Submit