irb not recognized in windows command line

B

Bert Ameche

I'm reading Beginning Ruby and followed the installation process , using
the one-click installer for Windows from Ruby Forge. I successfully
loaded fxri.
Received the following message after typing irb in the Windows command
prompt:

'irb' is not recognized as an internal or external command, operable
program or batch file.

Any suggestions on how to get this working will be greatly appreciated.
 
B

Bill Walton

Hi Bert,

Have you checked your PATH? It should contain an entry to ruby/bin. If
not, you'll need to add it. You might also check, just to make sure ruby
itself is operable, 'ruby -v' at the command line.

HTH,
Bill

----- Original Message -----
 
B

Bert Ameche

Bill said:
Hi Bert,

Have you checked your PATH? It should contain an entry to ruby/bin. If
not, you'll need to add it. You might also check, just to make sure
ruby
itself is operable, 'ruby -v' at the command line.

HTH,
Bill

----- Original Message -----

Thank you, Bill!

As you can probably tell, I'm not a programmer. I thought the paths
would be created automatically since the author of Beginning Ruby just
said to type irb at the command prompt to get irb(main):001:0> and this
will shows it's installed correctly.

When I enter Ruby commands into fxri, the expected results appear, so
that is set up correctly.

How would I create a path to ruby/bin? The books I have do not go into
paths unfortunately.

Bert
 
B

Bert Ameche

Bill said:
Hi Bert,

Have you checked your PATH? It should contain an entry to ruby/bin. If
not, you'll need to add it. You might also check, just to make sure
ruby
itself is operable, 'ruby -v' at the command line.

HTH,
Bill

----- Original Message -----

I forgot to mention that 'ruby -v' does not work either - get the same
message "ruby" is not recognized.
 
T

Tim Hunter

Bert said:
I forgot to mention that 'ruby -v' does not work either - get the same
message "ruby" is not recognized.

Your path has nothing to do specifically with Ruby. It's part of the way
Windows command prompt windows work. Your path is a list of directories.
When you enter a command at a command prompt, if the command is not
built into Windows itself (like dir, or chdir), then Windows searches
for the command in the directories listed in your path. You can make
temporary changes to your path using the SET PATH= command, or permanent
changes via the System tab in Control Panel.

When you install Ruby using the One-Click Installer, the installer
changes your path to include the directory in which it installs the ruby
and irb commands. That change does not affect existing command prompt
windows, it only affects command prompt windows that you start after
running the One-Click Installer. If you continue to use an command
prompt window that was open before you used the One-Click Installer,
then that window is still using the old path and therefore can't find
ruby or irb.

If you haven't started a new command prompt window since you installed
Ruby, close all of the command prompt windows you have open now and
start a new one. The new path will be in effect and you should be able
to run ruby and irb.

Here's more information about the path. It's for WinXP but I think
things are very similar in Vista:
http://www.computerhope.com/issues/ch000549.htm.
 
J

Joel VanderWerf

Bert said:
I forgot to mention that 'ruby -v' does not work either - get the same
message "ruby" is not recognized.

Maybe helpful, maybe not:

Are you using a command prompt window that was open before you installed
ruby? If so, try opening a new window. The environment variable settings
performed by the installer (such as the PATH to search for executable
programs) will not take effect retroactively.
 
B

Bert Ameche

Tim said:
Your path has nothing to do specifically with Ruby. It's part of the way
Windows command prompt windows work. Your path is a list of directories.
When you enter a command at a command prompt, if the command is not
built into Windows itself (like dir, or chdir), then Windows searches
for the command in the directories listed in your path. You can make
temporary changes to your path using the SET PATH= command, or permanent
changes via the System tab in Control Panel.

When you install Ruby using the One-Click Installer, the installer
changes your path to include the directory in which it installs the ruby
and irb commands. That change does not affect existing command prompt
windows, it only affects command prompt windows that you start after
running the One-Click Installer. If you continue to use an command
prompt window that was open before you used the One-Click Installer,
then that window is still using the old path and therefore can't find
ruby or irb.

If you haven't started a new command prompt window since you installed
Ruby, close all of the command prompt windows you have open now and
start a new one. The new path will be in effect and you should be able
to run ruby and irb.

Here's more information about the path. It's for WinXP but I think
things are very similar in Vista:
http://www.computerhope.com/issues/ch000549.htm.

Thanks you very much, Tim!

I actually uninstalled Ruby in the meantime and installed InstantRails.
It's working now.
 
B

Bert Ameche

Joel said:
Maybe helpful, maybe not:

Are you using a command prompt window that was open before you installed
ruby? If so, try opening a new window. The environment variable settings
performed by the installer (such as the PATH to search for executable
programs) will not take effect retroactively.

Thanks so much, Joel. I got it working in the meantime by uninstalling
Ruby and installing Instant Rails.
 
P

Pawel Zielniok

Just for anybody still looking solution having no admin rights in WinXP:

Start
-> Control Panel
-> System
-> Advanced
-> Environment Variables
-> New for User Variables
-> Variable Name: Path, Variable Value: C:\ruby\bin (if installed in
this folder).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top