I can't seem to find out how to do this... Thanks for any help. I have Ruby installed on my Mac (OS X Leopard) and it works fine from the terminal window. I'd like to create a dock shortcut or be able to just double-click the .rbw file to run it. When I click it, it just brings up a window that shows the code rather than running it. Is there a way to put a shortcut down in the dock so I can just click it to run the particular Ruby script (or click it from within Finder)? Thanks.
on 2009-03-21 12:50
on 2009-03-21 14:54
firstname.lastname@example.org wrote: > > Thanks. > > From the Finder, right-click and choose Get Info. On the Get Info window, use Open with to associate .rb files with ruby. Use Change All... to associate ruby with all .rb files.
on 2009-03-21 17:32
Tim Hunter wrote: > From the Finder, right-click and choose Get Info. On the Get Info > window, use Open with to associate .rb files with ruby. Use Change > All... to associate ruby with all .rb files. This looks fine, except you will not find ruby from within the "Choose Other Application" window!? Tim, could you tell us how exactly did you find Ruby there. Thank you in advance. Torli
on 2009-03-21 18:05
<email@example.com> wrote: > I have Ruby installed on my Mac (OS X Leopard) and it works fine from > the terminal window. I'd like to create a dock shortcut or be able to > just double-click the .rbw file to run it. When I click it, it just > brings up a window that shows the code rather than running it. Try FastScripts Lite. It's free and gives you a menu of scripts, and you can assign each script a keyboard shortcut. m.
on 2009-03-21 23:29
Torli Birnbauer wrote: > Thank you in advance. > Torli Well, rats. I can find ruby but OS X doesn't think it qualifies as an "Application". I suppose you could do something with Automator, but every time I start up Automator it makes me want to scream :-(
on 2009-03-22 00:59
unknown wrote: > Is there a way to put a shortcut down in the dock so I can just click > it to run the particular Ruby script (or click it from within > Finder)? > > Thanks. You should save the file as a Ruby file, but it must be made 'executable' to run as a script and not open in Terminal. To do this in terminal you need to use: chmod 755 /path/to/your/file This will keep it from opening in Terminal. But it won't be an application, so I don't think you can put it in the dock where you want it. If you want an Application which you can put on the dock, then you will need to wrap your script using Platypus (http://www.sveinbjorn.org/platypus). Platypus can take ruby (and other script langs) and create double clickable applications from them. You can also save your script with a unique prefix and name which will allow you to use Spotlight to run it. For example, save your script as xxMyScript.rb and you can access it relatively quickly using Spotlight in 10.5 (much slower and different key combinations on Tiger): 1) type cmd-spacebar to set focus to spotlight search field 2) type 'xx.MyS' and wait a sec for it to appear in the "Top Hit" of the Spotlight search results 3) type return when you see it as the "Top Hit" and it will launch and run. hth vince
on 2009-03-22 09:30
Thanks everyone. I'll give these a try.
on 2009-03-23 15:54
Well, rats. I can find ruby but OS X doesn't think it qualifies as an "Application". Well, it doesn't need to, the Terminal is an application, so given you put a shebang line on top of your program and make your file executable it could work... if you want to go arround having to change the file association for ruby files, change the extension to .command and it will open up and execute in the terminal. this only solves half of the problem though, you can click it, but still can't put it in the dock. L-P 2009/3/22 <firstname.lastname@example.org>
on 2009-03-23 16:13
ok, here is two quick options, both have limitations but they work to some point: if you don't need a terminal output for your app, create a folder hierarchy around it to make it a ruby app like this: appname.rb.app/Contents/MacOS/your_excutable_script.rb the .rb.app seems to be the important detail not to forget in here. or, if you need a terminal display for your app, you can always drop your .command (a said in my previous answer) in the document part of your dock (if you are on Leopard) and then clicking it will open a terminal and run it. L-P 2009/3/23 Louis-Philippe <email@example.com>