Installing Dart Sass

Install the Sass command-line tool on any operating system.

Syntaxnpm install -g sass

There are several ways to get Dart Sass. The most common is through npm (the Node.js package manager).

With npm

Install it as a dev dependency in your project, or globally on your machine.

Other options

  • Homebrew (macOS/Linux): brew install sass/sass/sass
  • Chocolatey (Windows): choco install sass
  • Standalone: download a release archive from the Sass GitHub page and add it to your PATH.

After installing, check the version to confirm it works.

Example

Example · bash
# Install globally with npm
npm install -g sass

# Or add to a project
npm install --save-dev sass

# Confirm the install
sass --version
# 1.x.x compiled with dart2js x.x.x

When to use it

  • A developer installs Dart Sass globally with npm so every project on the machine can use the sass command without per-project setup.
  • A CI pipeline includes npm install --save-dev sass so the exact pinned version is installed reproducibly before running the build script.
  • A developer on macOS uses Homebrew to install Dart Sass once and verifies the installation with sass --version before starting a project.

More examples

Install globally via npm

Installs the official Dart Sass package globally and confirms the installed version to ensure the tool is ready.

Example · bash
npm install -g sass
sass --version

Install as a dev dependency

Adds Sass as a project-level dev dependency so the version is locked in package.json and usable via npx in npm scripts.

Example · bash
npm install --save-dev sass
npx sass --version

Install on macOS via Homebrew

Uses the official Sass Homebrew tap to install Dart Sass as a standalone binary without requiring Node.js on macOS.

Example · bash
brew install sass/sass/sass
sass --version

Discussion

  • Be the first to comment on this lesson.