Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Windows

Ron Chan
Ron Chan
10,987 Points

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

I have downloaded the latest version of Ruby 2.1.5 (x64) and the corresponding development kit on my computer. Followed Jason's instructions for the installer, which includes adding Ruby executables to the PATH. I then extracted the devkit into a new subdirectory called devkit in the Ruby21 folder. But when I ran the ruby dk.rb init in the devkit subdirectory, I got the above message.

On inspecting the environment variables for my account, I see C:\Ruby21-x64\bin has already been specified in the PATH. I am not sure why it isn't running and don't know what I missed out. Appreciate any suggestions on what else I should try to troubleshoot this. I am running Windows 8 on my notebook.

2 Answers

Colin Bell
Colin Bell
29,679 Points

Are you typing ruby.dk init? It should be:

ruby dk.rb init

then

ruby dk.rb install

Ron Chan
Ron Chan
10,987 Points

I typed ruby dk.rb init in the devkit folder using the command prompt. Thank you for pointing that out the typo in my question. Just edited it.

Colin Bell
Colin Bell
29,679 Points

Do you get the same error when you type something simple like: ruby -v

Ron Chan
Ron Chan
10,987 Points

Yup, same error when I try typing other commands or elsewhere outside the directory.

Colin Bell
Colin Bell
29,679 Points

Hmm, my only suggestions would be to either reinstall ruby, making sure to check the "Add Ruby executables" option:

Or try out the second solution listed here

Ron Chan
Ron Chan
10,987 Points

Thanks for the link Colin! I tried replacing the PATH user variable in the environment variables with just C:\Ruby21-x64\bin; and it worked. Apparently my old PATH user variable is a very long list that is two pages long! I am guessing the list might be too long or I made some typos in it previously. I don't recommend other students try to change it without keeping a copy of the previous PATH as a backup.

Colin Bell
Colin Bell
29,679 Points

Good deal! Glad you got it working!

Colin Bell can you please help me also everytime I type jekyll serve, I get this here and I can't connect it to my localhost.. Please help

C:\RubyDevKit\newproject>jekyll serve Configuration file: C:/RubyDevKit/newproject/_config.yml Source: C:/RubyDevKit/newproject Destination: C:/RubyDevKit/newproject/_site Incremental build: disabled. Enable with --incremental Generating... jekyll 3.2.0 | Error: different prefix: "/" and "C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/minima-1.0.1"