Sass is a css development tool. Its installation depends on Ruby. If Ruby is not installed, please install Ruby first.
Assuming you have already installed Ruby, you can directly execute the following statement to install it.
gem install sass
Common error prompts:
1、ERROR:While executing gem ... (OpenSSL::SSL::SSLError)
hostname "gems.ruby-china.org" does not match the server certificate
Solution:
Execute the command to view the data source
gem source -l
result
*** CURRENT SOURCES *** https://ruby.taobao.org/ https://gems.ruby-china.org
you can delete the redundant
gem sources --remove https://ruby.taobao.org/ sudo gem update --system
Then reinstall.
2、ERROR:SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR: You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Fetching: ffi-1.9.18.gem ( 32%)ERROR: SSL verification error at depth 2: self signed certificate in certificate chain (19)
ERROR: Root certificate is not trusted (/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA)
ERROR: While executing gem ... (OpenSSL::SSL::SSLError)
hostname "gems.ruby-china.org" does not match the server certificate
3、ERROR:SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR: You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
Fetching: ffi-1.9.18.gem (100%)
Building native extensions. This could take a while...
Successfully installed ffi-1.9.18
ERROR: SSL verification error at depth 2: self signed certificate in certificate chain (19)
ERROR: Root certificate is not trusted (/C=US/O=GeoTrust Inc./CN=GeoTrust Global CA)
Fetching: rb-inotify-0.9.10.gem (100%)
Successfully installed rb-inotify-0.9.10
Fetching: sass-listen-4.0.0.gem (100%)
Successfully installed sass-listen-4.0.0
Fetching: sass-3.5.1.gem (100%)
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/sass
Solutions to the above errors 2 and 3
sudo gem install -n /usr/local/bin sass
Check
sass -v
The Sass version number is displayed correctly.
Update December 28, 2017:
After the Mac system was updated, Ruby was upgraded from 2.0 to 2.3. When using Sass again, an error was reported.
So decided to upgrade the SaaS and encountered an error when reinstalling. Finally found the solution:
Install libgmp-dev first, and then reinstall it.
brew install libgmp-dev sudo gem install -n /usr/local/bin sass