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 trialSam Lillicrap
12,127 PointsCan't install gems (Sass) can't write
Hi guys,
I'm new to Sass and working with terminal relatively speaking. I've been told ruby is already on most macs, I checked and it appears to be there.
However when I try and install Sass using:
gem install sass
but it returns the message:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
Does anyone know how I can change the permissions or give me directions for a work around? Sass looks like a really good time saver and I'm eager to learn it
Cheers -Sam
1 Answer
Paul Graham
1,396 Pointssudo
Sam Lillicrap
12,127 PointsSam Lillicrap
12,127 PointsI've been told that using sudo all the time isn't great (no idea why) - so I want to refrain from that if possible
Paul Graham
1,396 PointsPaul Graham
1,396 PointsYou can't
Sam Lillicrap
12,127 PointsSam Lillicrap
12,127 PointsWould be great if you could elaborate as to why it can't be avoided? I've been told that using ruby version management controllers can help but I've not figured out how to install them yet.
Paul Graham
1,396 PointsPaul Graham
1,396 PointsActually let me clarify, you can, but you'd need to install a user-owned Ruby from Homebrew or something like rbenv. You're using system Ruby which is system owned, therefore requires administrator rights to write to those directories.
Sam Lillicrap
12,127 PointsSam Lillicrap
12,127 PointsOkay great - is it advisable I use something like rbenv or is using system Ruby okay for things like Sass (I'm not thinking about ruby dev yet), Cheers
Paul Graham
1,396 PointsPaul Graham
1,396 PointsUsing system Ruby on Mavericks is fine since it's 2.0.
The reason you don't want to run system Ruby by default if you're a Ruby dev is that you're stuck on an old version. Ruby is a young language and is updated rapidly. In general you don't want to be stuck on an old Ruby because you'll lack features. The other issue is that Ruby versions are frequently incompatible with each other, so if you develop an app in Ruby 1.9.1, you probably want to lock the version there.
If you're just using the command line tools like Compass and Sass, forget it, especially if you're on Mavericks.
rbenv is generally easier to use and more straightforward than RVM in both development and production, although the latter is currently in a massive rewrite and has a nice GUI. You can install rbenv and it's needed helpers like ruby-build from Homebrew. rbenv.org has very easy to follow instructions.
Sam Lillicrap
12,127 PointsSam Lillicrap
12,127 PointsCheers, makes more sense now!