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!

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

CSS Sass Basics (retired) Getting Started with Sass Installing and Using Sass

Kevin Fitzhenry
Kevin Fitzhenry
30,096 Points

Error message in the command line for Mac when installing - gem install sass

(Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

I get this error message when typing: gem install sass

I want to follow along with the Sass course but know nothing about Ruby. Is it safe to be tinkering in the Terminal or should I steer clear until I have a clearer understanding.

Thanks in advance for any help / advice.

4 Answers

Kyle Meyer
Kyle Meyer
5,447 Points

Hey Kevin Fitzhenry,

Since you're using the default version of Ruby that came installed on your Mac, you need to use administrative privileges to install gems. The command would look like:

sudo gem install sass

This will prompt you for your administrator password and will install Sass after. This is safe and will allow you to continue with the course! Let me know if it works out for you.

Kevin Fitzhenry
Kevin Fitzhenry
30,096 Points

Wow, speedy response to my question. Thanks everyone. So, Kyle Meyer that worked but also gave a me a warning message that sudo command could cause deletion of files and data loss if I messed up the syntax or spelling of anything. Is this something that should totally freak me out since I am a complete n00b in the Terminal? Cause it does.

If I'm in the Terminal in the future should I follow Camron Schwoegler 's advice and try rbenv or RVM for a safer environment?

I think it's obvious I don't really understand what I am doing I just don't want to destroy my computer in anyway.

Thanks a ton for your help!

Kyle Meyer
Kyle Meyer
5,447 Points

Haha it should freak you out a little. :)

If you're just learning Sass and not planning to dip into Ruby programming, I'd just go ahead with the sudo command. If you choose to install a ruby version manager, I'd suggest rvm. :zap:

Thanks Kyle! I had the same issue.

Sam Kajjan
Sam Kajjan
20,547 Points

I had the same problem & i found a fix that worked for me

open terminal & write: xcode-select --install after it finished installing the xcode package type in the terminal: sudo gem install sass

To verify your sass version type in terminal: sass -v

Hope it works for you. cheers

Kiril Christov
Kiril Christov
9,208 Points

The only solution that works for me

Andrew Shook
Andrew Shook
31,709 Points

You may need to use sudo at the beginning of your install command.

Camron Schwoegler
Camron Schwoegler
4,784 Points

When you do gem install sass you're using the built-in Ruby and it tries to install the gem to the System-wide gem library in /Library and your user doesn't have permissions to write to that folder.

There are a few options that you can choose from.

  1. Run the command using sudo: sudo gem install sass

This will ask for your password and run the command as the root user which will have write permissions to that folder

  1. Look into a Ruby version manager such as rbenv or RVM.

This is a little more advanced and may take you a bit to get installed and develop a basic understanding but for the long-term might be a worthwhile time investment