Yehuda Katz is a member of the Ruby on Rails core team, and lead developer of the Merb project. He is a member of the jQuery Core Team, and a core contributor to DataMapper. He contributes to many open source projects, like Rubinius and Johnson, and works on some he created himself, like Thor.
@nzkoz Pairing is caring! Go Carlhuda! @carllerche ftw
Textmate gem
May 19th, 2008
As I said last week, I created thor while building a binary to handle my textmate bundles.
I wanted a way to install/uninstall/list textmate bundles like gems. Textmate already has a centralized svn repository for its bundles, and there’s a way, through AppleScript, to tell Textmate to reload bundles. The end result: a textmate binary that handles textmate bundles like gems.
$ textmate remote
Marcomates Trunk Remote Bundles ------------------------------- ANTLR ASP ASP_vb_NET ActionScript Active4D Ada Apache AppleScript Bison Blogging Bulletin Board Bundle Development C++ Qt C CSS CTags CVS ColdFusion Context Free D Darcs ... snip ...
$ textmate remote JavaScript
Marcomates Trunk Remote Bundles ------------------------------- JavaScript MooTools JavaScript Prototype & Script_aculo_us JavaScript YUI JavaScript jQuery JavaScript Marcomates Review Remote Bundles -------------------------------- JavaScript JSDoc JavaScript MooTools JavaScript Prototype & Script_aculo_us JavaScript
$ textmate list
Application Bundles ------------------- ActionScript Apache AppleScript Blogging Bundle Development C CSS ... snip ... User Pristine Bundles --------------------- User Bundles ------------ RSpec Ruby Haml Ruby Sass Ruby Rucola Treetop System Pristine Bundles ----------------------- System Bundles -------------- Ragel
$ textmate install
Checking out JavaScript jQuery…
svn co http\://macromates.com/svn/Bundles/trunk/Bundles/JavaScript\ jQuery.tmbundle /Users/wycats/Library/Application\ Support/TextMate/Pristine\ Copy/JavaScript\ jQuery.tmbundle 2>&1
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Commands
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Commands/Documentation for Word : Selection.tmCommand
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Snippets
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Snippets/each.tmSnippet
A /Users/wycats/Library/Application Support/TextMate/Pristine Copy/JavaScript jQuery.tmbundle/Snippets/clone.tmSnippet
… snip …
Checked out revision 9623.
Reloading Bundles…
Done.
$ textmate uninstall "JavaScript Prototype & Script_aculo_us"
Removing bundle... Reloading bundles... Done.
Pretty cool, huh? If you want it, do gem install wycats-textmate --source http://gems.github.com.

Dr Nic, Posted May 20, 2008, 12:34 am
Cool idea.
A bunch of tm bundles are now being cloned onto github and/or being hosted only on github. I name all mine xxx-tmbundle (e.g. hobo-tmbundle).
Perhaps a search of github projects by *-tmbundle might be a bonus too? The UI might need to prompt for the actual bundle’s name (e.g. hobo-tmbundle -> Hobo.tmbundle folder)
Might be fun.
Dr Nic, Posted May 20, 2008, 12:35 am
Another bonus feature might be a bash autocompletion script for the textmate command. So many cool features
Adam Sanderson, Posted May 20, 2008, 2:04 pm
This looks like a great tool, thanks for writing it.
Cate, Posted May 20, 2008, 2:33 pm
Nice. Can it be configured to use /Library/Application Support/Textmate instead of ~/Library/Application Support/Textmate?
chinclow, Posted August 12, 2008, 8:56 am
Thanks!
Hit a bug though: the textmate file in the gem directory had permission 733 (rwx-wx-wx) instead of 755 (rwxr-xr-x) which causes /usr/bin/textmate to not load it.
Andrew Vit, Posted August 26, 2008, 2:19 am
No worky… what am I doing wrong??
/usr/bin/textmate:19:in `load’: no such file to load — textmate (LoadError)
from /usr/bin/textmate:19
Jason Rogers, Posted September 6, 2008, 11:20 am
Andrew — chinclow was correct about the permissions of the textmate file in the gem directory. To fix your problem cd to your textmate gem directory and run “sudo chmod 755 bin/textmate”. On my system all gems are under “/usr/local/lib/ruby/gems/1.8/gems”. Your system may vary.
iBook, Posted October 10, 2008, 11:38 pm
To Follow up on what Jason Said, on mac the gems are stored in /Library/Ruby/Gems/1.8/gems/
Thanks,
Clayton Yocom
Werner Punz, Posted February 28, 2009, 5:04 pm
problem:
textmate remote
GitHub Remote Bundles
———————
/Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:29:in `remote’: undefined method `[]‘ for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:25:in `map’
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:25:in `remote’
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:16:in `each’
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:16:in `remote’
from /Library/Ruby/Gems/1.8/gems/thor-0.9.9/lib/thor/task.rb:27:in `send’
from /Library/Ruby/Gems/1.8/gems/thor-0.9.9/lib/thor/task.rb:27:in `run’
from /Library/Ruby/Gems/1.8/gems/thor-0.9.9/lib/thor/task.rb:20:in `parse’
from /Library/Ruby/Gems/1.8/gems/thor-0.9.9/lib/thor.rb:78:in `start’
from /Library/Ruby/Gems/1.8/gems/wycats-textmate-0.9.2/bin/textmate:218
from /usr/bin/textmate:19:in `load’
from /usr/bin/textmate:19
any ideas?
Martin Häcker, Posted May 19, 2009, 4:23 pm
Same problem as Werner here.
James Conroy-Finn, Posted June 11, 2009, 3:51 pm
If you’re getting a load error it might be a permission issue.
If you installed the gem as root and then try to run the binary as an unprivileged user ruby will report the file doesn’t exist.
You can chown the file to give you full access or better make it world executable.
HTH,
James