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 Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Mac

chris salvi
chris salvi
7,584 Points

Cant install rbenv as instructed in video for Ruby on Mac!! (-bash: $: command not found)

I have the latest version of ruby installed on my computer, but when I type in this command in the terminal

$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

I receive the error: -bash: $: command not found

Can someone explain what is going on here? I know I have git installed as well, and I really want to start learning ruby!!

Hi Chris!

Sorry to hear that you're having issues getting rbenv installed. It sounds like git might not be in your $PATH.

From the console can you run:

$ type git
chris salvi
chris salvi
7,584 Points

andrew,

Thanks for the reply, but I feel very dumb. The issue was I had multiple $ signs next to each other as I literally copied everything from the link.

Thanks and cheers!

Oh that makes sense now. I'm glad that you got it figured out on your own.

Happy coding!

chris salvi
chris salvi
7,584 Points

one minor suggestion that you or one of the staff may amend to the video. To install gems on Macs since we already have ruby installed, it requires the Sudo prefix before the install, otherwise it throws an insufficient privilege cannot write error. I found this out by looking at stackoverflow.

Keep up the good work. And hope to see more lessons on Ruby!

Chris,

If have to install gems with sudo, you might still be using the system Ruby (that came installed with your OS).

One of the advantages of using rbenv, is that you don't have to use sudo to install gems. This is because gems are installed in your home directory. You can find out what what version of Ruby you are currently using with rbenv versions and set the appropriate version with rbenv global.

chris salvi
chris salvi
7,584 Points

so I'm a tad unclear about the utility of rbenv. I've been taking the foundations course and we always immediately jump into the irb. Do i need to run rbenv first before I execute the irb? Sorry if I am not using the right lexicon to describe this all. I come from a background of javascript and am new to the console.

Also, where would my gems be stored currently, and should I reinstall them?

A little background might help.

In the beginning there was only one Ruby interpreter, but eventually people wrote other implementations (jruby, rubinius, etc). With all these other implementation things started getting harder to manage, so along came rbenv.

rbenv allows your to install multiple Ruby versions and switch between them easily. Once you set the version that you want there is no need to do anything (until you want to upgrade or change versions).

Running irb will use the Ruby version that was previously set with rbenv.

chris salvi
chris salvi
7,584 Points

thanks Andrew, you've been a tremendous help! I am always impressed by the responsiveness on these forums and one of the many reasons I plan on resubscribing. I will spend a little more research looking around the internet, but know I can use you for help if I ever come across anything peculiar.

Best!