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 Rails on Mac

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

I am having a problem properly downloading ruby gems.

"Installing RVM to /Users/maryanneleanya/.rvm/ Adding rvm PATH line to /Users/maryanneleanya/.profile /Users/maryanneleanya/.mkshrc /Users/maryanneleanya/.bashrc /Users/maryanneleanya/.zshrc. Adding rvm loading line to /Users/maryanneleanya/.profile /Users/maryanneleanya/.bash_profile /Users/maryanneleanya/.zlogin. Installation of RVM in /Users/maryanneleanya/.rvm/ is almost complete:

  • To start using RVM you need to run source /Users/maryanneleanya/.rvm/scripts/rvm in all your open shell windows, in rare cases you need to reopen all shell windows. MaryAnns-Air:~ maryanneleanya$ "

MaryAnns-Air:~ maryanneleanya$ gem install rails --version 5.0.0 ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

HI, EVERYTIME I TRY TO INSTALL RUBY GEMS --VERSION 5.0.0 I KEEP GETTING THE ERROR WRITTEN ABOVE. WHAT SHOULD I DO? IT ALSO CLEARLY SAYS THAT RVM HAS BEEN INSTALLED.

3 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi MaryAnn,

A permissions error mean you are running outside of the root. You will need to prefix your command with sudo. This stands for "Super User Do". When you use sudo be very careful and make sure you fully understand the command. Sudo use can be very dangerous if you're just running random commands.
When you use sudo you will be prompted for your password. This is your administrator password for your computer. If you are not the administrator or do not know the root password, you will not be able to access root commands.

This will install the Rails Gem you are attempting, and using sudo here is fine. The warning above is just in case in the future you are using the command line for stuff you are not completely sure of.

Hope this helps! :) :dizzy:

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

Thanks! So like this" sudo gem install rails --version 5.0.0". Also, should I be concerned about any harm that might come to my computer by using sudo?

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Yes, that is how it is used.

As for harm. This can only come from using it with commands in the console. sudo give you 'ultimate' access (root control) to your computer's operating system and can indiscriminately delete or otherwise alter essential files but only if you command it.

So, installing Gems (for example) which is very straight-forward, won't cause any harm. My warning is more to the effect that you don't just go copy/pasting commands you may come across that you are not sure what they do. There are some not-so-nice people online that I've occasionally seen in a blog or something similar post what seems to be an answer to a question that includes some "mean" code that could cause irreversible damage to your core files. PLEASE NOTE THOUGH... I've never seen this happen on Treehouse's Community

Really, it's just a heads-up. If someone says to run a line of code in the console that you really aren't sure about and it's prefixed with sudo, just be careful. Something like "sudo gem install rails --version 5.0.0" is pretty clear on what it's going to do, so you're good. :thumbsup:

If you have time and are interested (plus it will come in pretty handy in more advanced coding), Treehouse offers a very well made Console Foundation Course that does teach one enough to be pretty comfortable using the console. It also touches on the dangers a bit too. It's about 4 hours long, but well worth it!

Keep coding! :dizzy:

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

Thanks! And now it is asking me to specify a gemname. What should i write? I can't seem to find it from the video.

"ERROR: While executing gem ... (Gem::CommandLineError) Please specify at least one gem name (e.g. gem build GEMNAME)"

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

I am trying to install ruby rails. I have followed all the instructions in this video. "https://teamtreehouse.com/library/installing-rails-on-mac"

Every time I keep trying to install the rails gem it gives me the message below.

"ERROR: Error installing rails: activesupport requires Ruby version >= 2.2.2."

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

I figured it out, but when I run it it shows that the latest version is not downloaded. What should i do.

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

it is still showing the old version and ruby gems can't be installed unless the latest version of ruby is installed. " ruby -v ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]"

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Homebrew is the best way to Install Ruby in my opinion. Check it out. It's pretty simple and I use it for much more than just ruby. I haven't worked with Ruby for quite some time, so I'm not so up-to-date on RVM, but I do remember using Homebrew. Then keeping everything up to date is really simple.

:)

MaryAnn Eleanya
MaryAnn Eleanya
8,626 Points

Yes, I used homebrew and it is still not installing.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points
  1. Try upgrading Ruby through Homebrew. ==> run brew upgrade ruby in the console. This might take a bit, because sometimes Homebrew likes to upgrade other related stuff as well (never really understood that).

  2. Which Gem are you trying to install?