Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS Compass Basics Getting Started with Compass Installing Compass

Richard Nash
Richard Nash
24,862 Points

Ruby update installation issue and question...

I'm trying to update ruby on my mac just like Guil Hernandez suggests in the video and I get the following error:

Last login: Thu Oct 16 23:19:19 on console
rn-3:~ richardnash$ gem update --system
Updating rubygems-update
Fetching: rubygems-update-2.4.2.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
rn-3:~ richardnash$

Gil suggests to use sudo to become a super user temporarily, which works, or course, but I would prefer to simply have total control over my computer all the time so I do not have to deal with using sudo ever again.

So how do I become the master of my own computer?

2 Answers

Ruby and a set of default gems come bundled with all Macs. They are installed for all users, so it's hard for anyone but root to change them.

You'll need to install rvm, and then use rvm to install a version of Ruby. rvm will allow you to have multiple versions of Ruby installed at once (and switch between them at ease). It will also allow you to maintain dependency sets for each project of yours with gemsets.

So, once you install rvm, run rvm install ruby-head, and then gem install compass, and you should be good to go.

If you run into sudo issues with Homebrew, just use sudo. Homebrew only requires it for installation IIRC, not for continued use.

James Barnett
James Barnett
39,199 Points

but I would prefer to simply have total control over my computer all the time so I do not have to deal with using sudo ever again.

I like how this server fault answer puts it:

Most everyday tasks don't require a root shell. So it is good practice to use an unprivileged shell as your default behaviour and then only elevate to root when you need to perform special tasks.

By doing so you are reducing scope for dangerous mistakes (bad scripting, misplaced wildcards, etc) and vulnerabilities from any applications that you use.

For more details check out the Treehouse video on sudo in the Console Foundations course.