How To Fix "ruby is not recognized as an internal or external command, operable or batch file error"
Step 3 To check if everything is okay now, go back to your Command Prompt window and type in
We are lucky because installing ruby on Windows is pretty easy.
However, people often get the following error and are wondering what to do:
If you try to install a gem, gem install [something] won’t be recognized as a command either.
gem is not recognized as an internal or external command, operable or batch file
The reason:
Usually, that happens if you haven’t checked the “Add Ruby executables to your PATH” box during the Ruby installation process. In that case your environment won’t know where your Ruby installation is situated. Here is how to fix that.
Solution 1 Reinstalling Ruby
I would suggest reinstalling. Even though that might not be the best practice, it is fairly easier then the other solution. Just go to your Control Panel and uninstall Ruby. Then run the installation again and make sure you’ve checked the “Add Ruby… PATH” box this time. Then you can continue installing SASS, Compass or whatever you want.
Solution 2 Fix the problem manually
If you want to fix the problem manually, you will need to add the Ruby bin folder to your PATH user variable and add a new system variable to make the gem command work. To do that:
Start menu -> Right click on Computer -> Properties -> Advanced system settings (in the left panel) -> Advanced tab -> Environment Variables button
Step 1 In the User variables section, double click on Path (or select Path and press Edit).
If there is anything else there put a semicolon after it ; and add the path to your Ruby bin folder -> for example C:\Ruby193\bin or C:\Ruby200\bin Then press OK
ps. the 3 digits are the version of your Ruby installation. Just go to your C: drive and check the name of the Ruby folder.
Step 2 In the System variables section, press New. For variable name enter RYBUOPT and for variable valuerubygems Press OK on the small window and on the other two that remained opened.
Step 3 To check if everything is okay now, go back to your Command Prompt window and type in
ruby – v
If you get a message with your ruby version, you managed to solve the problem. Great!
EmoticonEmoticon