124

I am in the process of setting up a new Mac for work. I have installed Grunt & Grunt CLI globally. Then I did a npm install inside a project folder to install all dependencies.

No problems so far, but as soon as I try to run the sass:dist task, I get this warning:

Warning: You need to have Ruby and Sass installed and in your PATH for
this task to work. More info:
https://github.com/gruntjs/grunt-contrib-sass Use --force 
to continue.

What I understand is that I need to have Ruby and Sass installed on a more global level for this task to run. As I am still pretty new to working with the terminal, I did a quick search to find out what PATH is - seems like its some system path (that can be changed) where important data is stored.

Does this mean I can simply do a sudo grunt install contrib-sass -g to resolve the issue? And what about Ruby – I always thought its already installed on OS X?

Sven
  • 12,997
  • 27
  • 90
  • 148
  • Does this answer your question? [Grunt sass don't have ruby and sass installed?](https://stackoverflow.com/questions/24269242/grunt-sass-dont-have-ruby-and-sass-installed) – Silviu Burcea May 20 '20 at 14:20

8 Answers8

212

Ok I got it. I just had to install Sass using gem install sass and now everything is fine...couldn't be easier.

Sven
  • 12,997
  • 27
  • 90
  • 148
91

If you're on OSX El Capitan or Yosemite on Mac there seem to be an issue installing the gem.

Try

sudo gem install -n /usr/local/bin sass

Solution was from github.

ArtOfCode
  • 5,702
  • 5
  • 37
  • 56
John Richard Salt
  • 1,003
  • 8
  • 11
12

You need to install Ruby and Sass as:

For Ruby use command

sudo apt-get install ruby-full

And for Sass use command

sudo gem install sass
Gaurav
  • 872
  • 12
  • 28
8

grunt-sass documentation is not very clear. To avoid the need of Ruby, you can try this:

npm uninstall --save grunt-contrib-sass
npm install --save node-sass grunt-sass

Try this, It's work for me.

reference

  • 4
    This is the best answer in 2020. It makes SASS work like a charm and keeps all of the dependencies locally installed via npm. When adapting my code from grunt-contrib-sass to grunt-sass, I needed to make some adjustments to my grunt config, but their usage example made it easy: https://github.com/sindresorhus/grunt-sass#usage – Alexander Rice Jan 15 '20 at 20:42
  • Great, thanks for the tip! Had been searching how to get rid of that dependency to Ruby and you answered it. I would however use rather `npm install --save-dev` instead of `--save` because you only need sass for development (I just edited this in the answer). – Tobias May 07 '20 at 08:18
  • But after that, I had to change my Gruntfile.js: `const sass = require("node-sass"); grunt.initConfig({ sass: { options: { implementation: sass } }` Source: https://stackoverflow.com/a/68104462/6909703 – Sergiy Zaharchenko Apr 24 '22 at 09:12
2

You need to install Ruby and Sass as:

For Ruby use command

sudo apt-get install ruby-full

And for Sass use command

sudo gem install sass
biruk1230
  • 3,042
  • 4
  • 16
  • 29
Ruwan Bandara
  • 55
  • 1
  • 9
1

Use grunt --force if you are using grunt. If you want to run an application using grunt and a warning is occur like this. For ignoring this warning you can use --force.

  • 2
    Welcome to the Stack Overflow. You should add some more description to your answer. It is not best practice to post answers with just one sentence. – filipst Mar 09 '17 at 07:48
1

I used Homebrew to install Ruby and then Ruby to install SASS. Probably only the best way to do it if you already use Homebrew, or want to start using it regularly...

brew install ruby
gem install sass
squarecandy
  • 4,894
  • 3
  • 34
  • 45
1

Also simply brew install saas/sass/sass on Mac High Sierra (10.13.x)

Vaiden
  • 15,728
  • 7
  • 61
  • 91