3

I would like to use RVM with tcsh; how do I do this?

As far as I can see, there are no "official" instructions for this. I followed the instructions on "Using RVM with tcsh", but this didn't work for me; in particular, I don't have access to the Ruby binaries ruby, bundle, irb, rspec, etc.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
  • The best thing to do is directly ask the authors of RVM about using it with tcsh. Don't follow other instructions, instead go with what they say as they know RVM better than anyone. They specifically say "Note that that any outside tutorials are NOT supported whether they work or not. Tutorials are great, however we have spent massive amounts of man hours debugging the installation process. Please use the install process(es) from this site only, as this is the only supported installation types and methods." in the [installation](http://rvm.io/rvm/install) page. – the Tin Man Dec 09 '14 at 16:23
  • @theTinMan Thank you. There's [an issue for this](https://github.com/wayneeseguin/rvm/issues/125), which just says "patches welcome"; this is a perfectly valid answer, and I'm not adverse to creating a patch, but 1) It's unlikely that I have the time do this properly in the foreseeable future, and 2) I've been given to understand that RVM2 is on the way, which is a complete rewrite (so my efforts would be wasted)... I understand 3rd party guides are unsupported, but there doesn't seem to be a way to get it working in tcsh; will opening a new issue be meaningful? – Martin Tournoij Dec 09 '14 at 17:15
  • Maybe instead of opening an issue, talk to them in IRC and see what they think. You might have just what they need to bootstrap including tcsh, and they can fill in the blanks. Waiting for a possible RVM2 doesn't mean that tcsh will be supported then, so getting the information to them can't hurt and might help. – the Tin Man Dec 09 '14 at 17:25

2 Answers2

1

This worked well for me on OS X Yosemite 10.10.2, though it adds about a 5-second delay to opening a Terminal window each time due to the RVM initialization.

Create this file:
https://gist.github.com/chetstone/1361149

I put it in ~/.rvm/rvm.rb

chmod +x rvm.rb

Add to your .cshrc/.tcshrc:

alias rvm 'eval `~/.rvm/rvm.rb \!*`'
rvm use ruby --default

ruby -v now returns the correct version.

ChefAndy
  • 11
  • 1
0

What I did was get all rvm-related environment variables from bash with env | grep -i rvm.

I then copied them to my ~/.tcshrc, and substituted the ruby version with $ruby_version:

if ( ! $?ruby_version ) then
    set ruby_version = `grep RUBY_VERSION ~/.rvm/environments/default | cut -d= -f2 | tr -d \' | sed 's/^ruby-//'`
end

setenv rvm_bin_path $HOME/.rvm/bin
setenv GEM_HOME $HOME/.rvm/gems/ruby-$ruby_version
setenv IRBRC $HOME/.rvm/rubies/ruby-$ruby_version/.irbrc
setenv MY_RUBY_HOME $HOME/.rvm/rubies/ruby-$ruby_version
setenv rvm_path $HOME/.rvm
setenv rvm_prefix $HOME
setenv PATH $HOME/.rvm/gems/ruby-$ruby_version/bin:$HOME/.rvm/gems/ruby-$ruby_version@global/bin:$HOME/.rvm/rubies/ruby-$ruby_version/bin:${PATH}:$HOME/.rvm/bin
setenv GEM_PATH $HOME/.rvm/gems/ruby-${ruby_version}:$HOME/.rvm/gems/ruby-${ruby_version}@global

$ruby_version will be set to the default; if it's empty; to use a different ruby version, I can do:

% set ruby_version = 1.9.3-p547
% source ~/.tcshrc

Using (some) rvm commands, such as rvm install or rvm list also seem to work; but rvm use doesn't (you need to use the $ruby-version workaround). I didn't check all the other commands, though.

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146