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

Ruby

Edward Bryan Kene Morales
Edward Bryan Kene Morales
7,374 Points

Cannot get the version of Ruby after installing

Hi Guys,

I just installed ruby in my windows computer but I cannot get the installed version after I installed it. I am running on Windows 8.1 X64.

First I am using git bash. It's weird because I can get the version of git and node js which is also installed in my computer.

I ran

ruby --version

but it returns

ruby: command not found

Anyone can help me? Please?

2 Answers

Stone Preston
Stone Preston
42,016 Points

you need to add Ruby to your PATH

note the steps below assume a Ruby version of 1.9.3, yours may differ

All you have to do is add the path to your Ruby bin folder in your windows environment variables. It doesn't have to be in the format /c/path/to/ruby, it can be C:\Ruby193\bin.

Step by step for Windows 7:

Start

Search programs and files (default textbox after hitting the Start icon), Search for 'environment'

Select 'edit the system environment variables'

Click 'Environment Variables' (bottom right of the form)

Add to the 'System Variables' 'PATH' the following ';C:\Ruby193\bin' (without the single quotes)

Restart your shell

Make sure to close your git-bash shell and restart it to pick up the new environment variable.

source: http://stackoverflow.com/questions/3426347/how-to-run-ruby-and-git-commands-in-one-place-on-windows

Stone Preston
Stone Preston
42,016 Points

no problem. Whenever you install something new, and are trying to issue commands and its returning a command not found error, usually its because its not in your PATH variable.

The path variable is where bash looks to find your commands. Its essentially a list of directories, and bash checks each one for the command you typed until it finds it.

in this case, the directory where your Ruby is installed was not in the PATH, so bash couldnt find it

Edward Bryan Kene Morales
Edward Bryan Kene Morales
7,374 Points

Hi Stone,

Thank you so much! You really helped me out a lot.

So I already solved the issue with ruby, but now, I can't seem to install any gems from the repository. I tried running

gem install sass

and

gem install compass

But it returns an error - something about certificate verification error. So I downgraded from 2.1 down to 2.0 because I read somewhere that the newest one has this error on windows. But still it doesn't work. I can't go down to 1.9 because I guess the latest version of Sass requires ruby 2.0.

Any thoughts about this?

Stone Preston
Stone Preston
42,016 Points

can you post the error message you get

Stone Preston
Stone Preston
42,016 Points

looks to be a problem with the SSL connection. use the non ssl host by changing the source from https to http

$ gem source -a http://rubygems.org/

then try installing sass again

source: http://stackoverflow.com/questions/27278966/error-sass-installation-for-windows

Edward Bryan Kene Morales
Edward Bryan Kene Morales
7,374 Points

This really getting frustrating :( I was able to change the address for the download but now it's presenting another error. It shows that sass was installed and I can pull the version of it through

gem sass --version

but i dont think it's a successful installation is it? Sigh, is this how difficult it is to install ruby and ruby gems in windows? :(

Stone Preston
Stone Preston
42,016 Points

you should try cloud 9. its what I use for Rails development. Its a cloud ide that gives you a fully functioning unix development environement in the browser. you can create workspaces specifically designed for Rails. its pretty awesome and easy to use. I really hate developing locally now that ive started using it