views:

28

answers:

3

I never used ruby before, I just wanted to play around with HAML and SASS. I downloaded and installed Ruby's Windows installer (v1.9.1). Then, I clicked ruby.exe (the icon with a black window and a multicolored gem in the picture). Finally, I typed gem install haml and pressed Enter. But nothing happened. Am I doing something wrong?

Reference picture:

alt text

+2  A: 

You might need to put the path to Ruby into the PATH environment variable to do this, but this is how I do it:

I open up the command line utility. I then type ruby -S gem install <whatever>. This works like a charm.

I tried running Ruby and it shows a blank screen but lets me type code. When I press CTRL + C to cancel it then executes my code as well. Maybe you need to do that in the manner you are trying to right now. I just find it easier to just ruby -S <statement> instead. IronRuby gives me the REPL no problems though.

Tacoman667
+1  A: 

ruby.exe is the Ruby interpreter. If you want to type code into it, you obviously need to type Ruby code into it, not DOS command code.

The gem command is a DOS batch file (gem.bat). DOS batch files need to be run from the DOS command interpreter.

Jörg W Mittag
A: 

Hello,

Installing Ruby using RubyInstaller, you get an shortcut in the Programs menu that let you open a command prompt with Ruby in the PATH

You use that in case you didn't select the option to add Ruby to the PATH.

Either case, the gem command you typed in should be entered at the command prompt, and not inside Ruby itself.

Luis Lavena