## 安裝Sass和Compass
`sass`基于`Ruby`語言開發而成,因此安裝`sass`前需要[安裝Ruby](http://rubyinstaller.org/downloads)。(注:mac下自帶Ruby無需在安裝Ruby!)
window下安裝SASS首先需要安裝`Ruby`,先從官網[下載Ruby](http://rubyinstaller.org/downloads)并安裝。安裝過程中請注意勾選`Add Ruby executables to your PATH`添加到系統環境變量。如下圖:

安裝完成后需測試安裝有沒有成功,運行`CMD`輸入以下命令:
~~~
ruby -v
//如安裝成功會打印
ruby 2.2.2p95 (2015-04-13 revision 50295) [i386-mingw32]
~~~
如上已經安裝成功。但因為國內網絡的問題導致`gem`源間歇性中斷因此我們需要更換`gem`源。(使用淘寶的gem源https://ruby.taobao.org/)如下:
~~~
//1.刪除原gem源
gem sources --remove https://rubygems.org/
//2.添加國內淘寶源
gem sources -a https://ruby.taobao.org/
//3.打印是否替換成功
gem sources -l
//4.更換成功后打印如下
*** CURRENT SOURCES ***
https://ruby.taobao.org/
~~~
`Ruby`自帶一個叫做`RubyGems`的系統,用來安裝基于`Ruby`的軟件。我們可以使用這個系統來 輕松地安裝`Sass`和`Compass`。要安裝最新版本的`Sass`和`Compass`,你需要輸入下面的命令:
~~~
//安裝如下(如mac安裝遇到權限問題需加 sudo gem install sass)
gem install sass
gem install compass
~~~
在每一個安裝過程中,你都會看到如下輸出:
~~~
Fetching: sass-3.x.x.gem (100%)
Successfully installed sass-3.x.x
Parsing documentation for sass-3.x.x
Installing ri documentation for sass-3.x.x
Done installing documentation for sass after 6 secon
1 gem installed
~~~
安裝完成之后,你應該通過運行下面的命令來確認應用已經正確地安裝到了電腦中:
~~~
sass -v
Sass 3.x.x (Selective Steve)
compass -v
Compass 1.x.x (Polaris)
Copyright (c) 2008-2015 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass
~~~
如下sass常用更新、查看版本、sass命令幫助等命令:
~~~
//更新sass
gem update sass
//查看sass版本
sass -v
//查看sass幫助
sass -h
~~~