mplsgetscold
mplsgetscold

Reputation: 33

Error installing SASS gem - don't have permissions

I'm not well versed in terminal, but I'll try my best to make this as clear and concise as I can.

I'm trying to install SASS and get the following errors:

When using gem install sass I get .

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

When using sudo gem install sass I get .

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

I have Xcode installed and I have agreed to the terms.

I even tried updating my Ruby, but terminal tells me I already have the most updated version.

ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]

The worst part of all of this is that when I navigate to my Ruby/Gems/2.3.0/gems directory, there is a sass-3.5.5 folder!!! (linked image to follow)

Ruby directory path to sass folder

I try running sass -v and get -bash: sass: command not found

I feel like I've tried everything that I can think of or find online. I'm at a loss and definitely need some help.

Upvotes: 3

Views: 1668

Answers (3)

JoshuaTree
JoshuaTree

Reputation: 1261

Or one could update the directory for where gems are installed.

Please see the origional answer here: https://stackoverflow.com/a/2619731/3302764

export GEM_HOME=~/.gem export GEM_PATH=~/.gem

Upvotes: 1

nambk
nambk

Reputation: 455

I prefer not touching sudo command, so I managed to solve this issue by referring to SASS home page:

If you use Node.js, you can also install Sass using npm by running

npm install -g sass

If you find it helpful, kindly upvote or leave comment so that I know it can solve your issues too.

Upvotes: 1

Arun Mathew Kurian
Arun Mathew Kurian

Reputation: 536

The issue can be fixed by installing RVM or Rbenv for managing ruby versions and gems.

Also, FilePermissionError can be fixed using the -n parameter

sudo gem install sass -n /usr/bin

Upvotes: 2

Related Questions