Ubuntu 16.04 / How to install Sass

To install legacy Ruby Sass on Ubuntu 16.04, you can use the ruby-sass package from APT or the sass gem from RubyGems. However, Ruby Sass is a discontinued implementation, so it should only be considered when reproducing existing projects, and for new development environments, use a currently supported OS and Dart Sass. Installing via gem does not install the latest Dart Sass either.

Check implementation and OS support before installing

Sass is a tool that converts stylesheets written with variables and nested rules into CSS (Cascading Style Sheets). SCSS is a Sass syntax similar to CSS using curly braces, and the file extension is .scss. Even with the same command name sass, Ruby Sass and Dart Sass are different implementations.

According to the official Sass guide, Ruby Sass reached the end of its support in 2019. Ubuntu 16.04 has also ended both its standard support and Expanded Security Maintenance (ESM), and as of October 2026, additional security support requires checking the conditions of Ubuntu Pro's Legacy add-on service. The operating system support scope can be found in Canonical's Ubuntu 16.04 guide.

Purpose Method to choose Conditions to check
Reproducing existing builds of Ubuntu 16.04 APT's ruby-sass Check the installation candidates in the repository and the version required by the project.
Existing projects require a specific Ruby Sass gem Install the specified version using RubyGems Ruby and dependent gems also need to be compatible.
Switch to a new project or a build under maintenance Dart Sass on supported operating systems This is distinguished from the procedure of using the default Node.js of older Ubuntu versions as is.

First, back up your source code and existing CSS, and check the implementations and versions used in the project's Gemfile.lock, package.json, etc. The two old installation methods below are alternatives, so there is no need to install both.

Install legacy Ruby Sass with APT

To reproduce the distribution package used on Ubuntu 16.04, check in the terminal in the following order. You need an account that can run sudo and access to an APT repository that works properly.

sudo apt update
apt-cache policy ruby-sass
sudo apt install ruby-sass
sass --version

The Candidate field in apt-cache policy shows the package version selected for installation. If there are no candidates or if the update fails, do not assume installation is possible; first check the repository settings, network, and support status of the environment. Do not arbitrarily add a repository or disable signature verification just because a package cannot be found.

After installation, the Sass version should be displayed. The distribution package version may differ from the gem version, and Sass 3.4.23 (Selective Steve) from previous posts is an example of past output. The current installation result does not necessarily have to match that string.

Install the required legacy version with RubyGems

This is a method to review when an existing project requires the Ruby Sass gem. Below is an example specifying 3.7.4, and if the project requires a different version, give priority to that requirement. RubyGems Sass 3.7.4 information indicates that Ruby 2.0.0 or higher is required, but this condition alone does not mean all dependent gems can be installed on older Ruby versions.

sudo apt update
sudo apt install ruby
ruby --version
gem --version
gem install --user-install sass -v 3.7.4 --no-document

--user-install is an option to install it in the user gem directory instead of system-wide. If a warning shows that the executable cannot be found, follow the RubyGems user installation guide and add the bin of the directory to your PATH. In Bash, you can apply the following command to your current terminal and then verify.

export PATH="$(ruby -r rubygems -e 'print Gem.user_dir')/bin:$PATH"
sass --version

If this is a setting you will continue to use, add the above export line to ~/.bashrc once and check it in a new terminal. To revert, remove the added line and reopen the terminal. If installation fails, check the dependent gems and Ruby version shown in the error, and reproduce the environment based on the lock file stored in the project and the environment at the time. Do not disable HTTPS verification to resolve certificate or TLS errors.

Verify installation by converting SCSS to CSS

Just printing the version does not confirm the actual conversion. In a separate empty work folder, create a style.scss file and save the entire content below. In a folder with existing files, first ensure there is no conflict with existing example file names.

$brand: #336699;

.notice {
  color: $brand;
  strong {
    font-weight: 700;
  }
}

Running the following command in that folder will generate style.css.

sass style.scss style.css

The generated CSS should contain the selectors and values below. Depending on the implementation and output format settings, spaces, line breaks, or source map comments may vary.

.notice {
  color: #336699;
}

.notice strong {
  font-weight: 700;
}

Change the color values and convert again to see if the values in the CSS change, confirming the relationship between the input and output files. Reverting to the original values and running again will restore the example state. Sass conversion is the process of creating CSS files, and to apply it to a webpage, you need to load the output CSS in the corresponding HTML.

When commands conflict or installation needs to be reverted

If sass: command not found appears after installation, check whether the installation was successful and review the PATH. If a different version appears than expected, see which executable is selected first—whether installed via APT, user gem, or another tool.

command -v sass
type -a sass
sass --version

Placing the user gem’s bin in front of the PATH may give priority to that command. In environments with duplicate installations via APT and gem, do not just look at the version number; also record the path. Instead of arbitrarily deleting files, remove them using the management tool used for installation.

  • To revert an APT installation, use sudo apt remove ruby-sass. Before running, read the list of items to be removed and ensure they are not in use by other projects.
  • To remove the user gem in the example above, use gem uninstall --user-install sass -v 3.7.4. There is no need to remove other versions or shared dependencies in bulk.
  • If the error is caused by incompatible modern SCSS syntax, simply reinstalling may not resolve it. Build with the implementation required by the project, or review the code to switch to Dart Sass.

Switch to Dart Sass in a new environment

The current reference implementation of Sass is Dart Sass. The official installation documentation guides you to install a standalone distribution or npm installation suitable for your operating system and CPU. The npm example in this section is a procedure to run in a separate development environment prepared with supported operating systems and the Node.js required by the corresponding Sass version, and it does not assume execution on the default Node.js of Ubuntu 16.04.

Once Node.js and npm are ready, you can install project-specific development dependencies in a new project folder with the following command. When applying to an existing project, first back up package.json and the lock file, then check the existing build settings.

npm init -y
npm install --save-dev sass
npx sass --version
npx sass style.scss style.css

Before running the last command, you must save the previous section's style.scss in the same folder. npx sass uses the project-local Sass installed by this procedure and may differ from the global sass command and version. You can verify the installation result with npm ls sass and the generated CSS. The development dependencies added in this example can be removed with npm uninstall --save-dev sass.

When transferring an old project, compare the conversion results on a test branch or copy, and review CSS differences and warnings before applying them. You can check the command and options for single-file conversion in the Dart Sass command-line documentation . Installing Ruby Sass and switching to the current Dart Sass are separate tasks.