TextMate, rvm and TM_RUBY

In the TextMate RVM instructions the text it says to set TM_RUBY to /Users/wayne/.rvm/bin/textmate_ruby and in the image it shows it set to rvm-auto-ruby. I decided to set it to rvm-auto-ruby thinking that it would use RVM's default Ruby version.

When running Command R in the RSpec.bundle having TM_RUBY set to rvm-auto-ruby will result in a load error. When you set it to textmate_ruby it works.

The only problem here is that TextMate doesn't always use the default version of Ruby since it's hardcoded in that file.


#!/usr/bin/env bash

if [[ -s "/Users/jspooner/.rvm/environments/ruby-1.9.2-head" ]] ; then
  source "/Users/jspooner/.rvm/environments/ruby-1.9.2-head"
  exec ruby "$@"
  echo "ERROR: Missing RVM environment file: '/Users/jspooner/.rvm/environments/ruby-1.9.2-head'" >&2
  exit 1

So two questions:

  1. What should TM_RUBY=rvm-auto-ruby actually do?
  2. Is there a way to have TextMate use the RVM default?


See your other, similar, question Rspec bundle is broken in TextMate and rvm.

To help others chasing this same issue, the solution seems to be at: RVM / Textmate doesnt recognize .rvmrc Options.

Basically you replace the ~/.rvm/bin/textmate_ruby soft link with a file. This is what I did:

  1. cd ~/.rvm/bin
  2. mv textmate_ruby old.textmate_ruby
  3. Create a shell script called textmate_ruby in the same directory to replace the soft-link, using the following contents:
    #!/usr/bin/env sh 
    source ~/.rvm/scripts/rvm 
    cd . 
    exec ruby "$@" 
  4. chmod +x textmate_ruby

Before doing this change I'd see my system Ruby's version (1.8.7) displayed if I did CMD+R to run the following script in TextMate:


Evaluating the script using CMD+CNTRL+SHIFT+E gave me 1.9.2.

After switching to use that script both point to Ruby 1.9.2, so at least there's some consistency now. I don't see TextMate tracking my currently set RVM Ruby version yet; Instead it's using the default version set in RVM: rvm use 1.9.2 --default. This is still a step forward because I can control which Ruby TextMate uses by adjusting my --default.

If you decide you want to revert later, just rename, or delete, the script and reverse step 2 above.

Setting TM_RUBY to your-path/rvm-auto-ruby


should load whatever ruby and gemset is indicated in the .rvmrc file located in the project and if none default to rvm default. I just got this working and it is very smooth. I did need to get the latest version of rvm

rvm get head

to make it work and restart Textmate. Hope that helps.

Need Your Help

How can I achieve this listview row layout in XML?

android xml

I can't seem to get the date positioned appropriately in the layout. I am trying to achieve something like this:

Unrecognized selector when deleting a NSManagedObject

ios objective-c core-data

I'd like to delete a core data object by fetched the object first, so

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.