This is the first of a series of posts on using Xcode to edit Ruby files.
For those that are familiar with Xcode, this will likely not be very informational, but for those of us that are new to Apple's programming editor, perhaps it will be useful. Xcode ships with Apple's developer tools which can be downloaded here (free/subscription required). A little known fact is that Xcode syntax highlights Ruby source code, so if you aren't a VIM or Emacs disciple, perhaps Xcode is for you.
First things first. If you always want to edit your Ruby files using the Xcode editor, use the Finder to browse to a folder with a Ruby (.rb file) in it. Then single click on the file (to select it) and then chose the File/Get Info menu item. This will present a nice long information panel. In that panel there is an 'Open with:' section that has a drop down in it. Select that then choose 'other'. This will bring up a file browser. The Xcode .app file is located in /Developer/Applications. After you select 'Xcode' make sure and select the 'Always open with' checkbox in the lower left corner, then press the 'Add' button. The drop down should now say 'Xcode' and if you click on the 'Change All...' button the Finder will open all Ruby files with Xcode.
That's it. Now, whenever to double-click on a Ruby (.rb) file in the Finder, it will open the Xcode editor. Also, if you are at a command line and there is a Ruby script you want to edit, you can just type 'open myscript.rb' and it will open the default application for .rb files...which we have now made Xcode!
In my next post I will discuss setting up the editor using the Preferences in Xcode that make editing Ruby extra special (like showing line numbers, indenting, coloring, etc). I will conclude with post on using the project capability of Xcode to edit groups of Ruby files.