tags:

views:

204

answers:

2

I can't get the Ruby interpreter to run on either of my Macs (one MacBook and one MacBook Pro, both running Snow Leopard). When I run it, by typing ruby in Terminal, nothing happens. It just sits there. I can kill it by pressing Ctrl+C, but that's it. I know the Ruby process is running, since I can see it in Activity Monitor, and running ruby --version works fine.

I have tried the following, all to no avail:

  1. I have some bash customizations, so I tried disabling them, but that didn't help.
  2. I installed a new copy of Ruby 1.8.7 using MacPorts, but that one had the same problem.
  3. I tried quitting and restarting the Terminal application.

Some other information that might be useful:

  • I'm trying to run the version of Ruby that comes with Snow Leopard.
  • I have installed Apple's developer tools.
  • Other interpreters (Python, Io, etc.) work fine.

I spent a while tonight searching for this problem online, but haven't found any discussion of it. I'm at a loss for what could be causing it, so any help anybody can provide would be greatly appreciated.

+2  A: 

What are you trying to do, exactly? The ruby command expects input, in most cases a file that contains Ruby code that you want it to run. In that case you have to specify the name of the file:

> ruby my_ruby_file.rb

If instead you want to run the interactive Ruby shell, i.e. the REPL console that you can type Ruby code into and have it executed each time you press enter, the command you want is irb.

Jordan
+3  A: 

Ruby command itself will just behave the way you said, either provide it with script file or use the -e option like doing ruby -e 'puts "hello world"'

However i suspect that you want the IRB(interactive ruby), just run irb in ur shell...

khelll
Ugh, thanks. I completely forgot that irb was a separate command.
Tom S.