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:
- I have some bash customizations, so I tried disabling them, but that didn’t help.
- I installed a new copy of Ruby 1.8.7 using MacPorts, but that one had the same problem.
- 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.
Ruby command itself will just behave the way you said, either provide it with script file or use the -e option:
ruby -e ' puts "hello world" 'However I suspect that you want the IRB(interactive ruby). Run
irbin your shell.