Lesson 15 min

Installing Dart SDK (Windows/Mac/Linux)

00:00 / 00:00

Installing Dart SDK (Windows / Mac / Linux)

Before you write a single line of Dart code, you need the Dart SDK installed on your machine. The SDK (Software Development Kit) contains everything you need: the Dart runtime, the dart command-line tool, the package manager (pub), and the compiler.

In this lesson, we'll walk through installation on all three major operating systems — step by step — and make sure everything is working correctly.


What is the Dart SDK?

The Dart SDK is a collection of tools and libraries that allow you to:

  • Run Dart programs (dart run)
  • Compile Dart to native executables (dart compile exe)
  • Analyze your code for errors (dart analyze)
  • Format your code (dart format)
  • Manage packages via pub (dart pub get)

Tip: If you're planning to use Flutter, the Flutter SDK already bundles the Dart SDK — you won't need a separate installation. However, for pure Dart development, install it independently.


🪟 Installation on Windows

You have two options on Windows: using winget (recommended, fast) or downloading manually from the official website.

Option 1 — winget (Recommended)

winget is Windows' built-in package manager available on Windows 10 (v1709+) and Windows 11.

Open PowerShell or Command Prompt as Administrator and run:

powershell
winget install Dart.Dart

That's it! winget will download and install the latest stable Dart SDK and automatically add it to your system PATH.

Option 2 — Chocolatey

If you use the Chocolatey package manager:

powershell
choco install dart-sdk

Option 3 — Manual Download

  1. Go to https://dart.dev/get-dart
  2. Click Download the Dart SDK under Windows
  3. Extract the ZIP file to a directory like C:\dart-sdk\
  4. Add C:\dart-sdk\bin to your system PATH manually (see below)

Setting PATH on Windows (Manual Install Only)

If you installed manually, you need to add the Dart bin folder to your PATH:

  1. Open Start Menu → search for "Environment Variables"
  2. Click "Edit the system environment variables"
  3. Click "Environment Variables..."
  4. Under "System variables", find and select Path, then click Edit
  5. Click New and add:
    C:\dart-sdk\bin
    
  6. Click OK on all dialogs
  7. Restart your terminal

🍎 Installation on macOS

The easiest way to install Dart on macOS is via Homebrew.

Step 1 — Install Homebrew (if not already installed)

bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2 — Tap the Dart Repository

bash
brew tap dart-lang/dart

Step 3 — Install Dart

bash
brew install dart

Homebrew will automatically handle PATH configuration.

Upgrading Dart on macOS

To update Dart to the latest version in the future:

bash
brew upgrade dart

Install a Specific Version (macOS)

bash
brew install dart@3.0

🐧 Installation on Linux

Option 1 — apt (Debian/Ubuntu)

bash
# Step 1: Install dependencies sudo apt-get update -y sudo apt-get install apt-transport-https -y # Step 2: Add Google's signing key wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub \ | sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg # Step 3: Add the Dart repository echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' \ | sudo tee /etc/apt/sources.list.d/dart_stable.list # Step 4: Install Dart SDK sudo apt-get update -y sudo apt-get install dart -y

Option 2 — yum / dnf (Fedora / RHEL / CentOS)

bash
# Add the repository sudo rpm --import https://dl.google.com/linux/linux_signing_key.pub sudo curl https://storage.googleapis.com/download.dartlang.org/linux/rpm/dart_stable.repo \ -o /etc/yum.repos.d/dart_stable.repo # Install sudo yum install dart # or on Fedora: sudo dnf install dart

Option 3 — Snap (Any Linux Distro)

bash
sudo snap install dart --classic

Setting PATH on Linux (if needed)

After installation, if dart isn't found, add it to your PATH in ~/.bashrc or ~/.zshrc:

bash
export PATH="$PATH:/usr/lib/dart/bin"

Then apply the changes:

bash
source ~/.bashrc # or for zsh: source ~/.zshrc

Verifying the Installation

Once installed on any platform, open a fresh terminal and run:

bash
dart --version

You should see output similar to:

Dart SDK version: 3.x.x (stable) (...)

Also verify that the package manager works:

bash
dart pub --version

And check what tools are available:

bash
dart help
A command-line utility for Dart development.

Usage: dart <command|dart-file> [arguments]

Available commands:
  analyze   Analyze Dart code in a directory.
  compile   Compile Dart to various formats.
  create    Create a new Dart project.
  format    Idiomatically format Dart source code.
  pub       Work with packages.
  run       Run a Dart program.
  test      Run tests for a project.

Common Installation Errors & Solutions

Error: dart is not recognized as an internal or external command

Cause: The Dart bin directory is not in your PATH.

Fix (Windows):

powershell
# Check current PATH in PowerShell $env:PATH -split ";" # Manually add temporarily to test: $env:PATH += ";C:\dart-sdk\bin" dart --version

Fix (Mac/Linux):

bash
# Find where dart was installed which dart # Add to PATH (replace with your actual path) export PATH="$PATH:/path/to/dart/bin"

Error: winget command not found (Windows)

Fix: Update Windows to the latest version or install the App Installer package from the Microsoft Store.


Error: brew: command not found (macOS)

Fix: Install Homebrew first:

bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Error: Certificate / SSL errors during Linux apt install

Fix:

bash
sudo apt-get install ca-certificates -y sudo update-ca-certificates

Error: Permission denied (Linux)

Fix: Use sudo for all installation commands, or fix permissions:

bash
sudo chmod -R 755 /usr/lib/dart/bin

Error: Old Dart version after update

Fix:

bash
# macOS brew upgrade dart # Linux (apt) sudo apt-get update && sudo apt-get upgrade dart # Verify dart --version

Quick Reference — All Platforms

PlatformCommand
Windows (winget)winget install Dart.Dart
Windows (choco)choco install dart-sdk
macOS (brew)brew tap dart-lang/dart && brew install dart
Ubuntu/Debiansudo apt-get install dart
Fedora/RHELsudo dnf install dart
Any Linuxsudo snap install dart --classic
Verifydart --version

Summary

In this lesson, you learned how to:

  • Install Dart SDK on Windows using winget or manual download
  • Install Dart SDK on macOS using Homebrew
  • Install Dart SDK on Linux using apt, yum, or snap
  • Configure PATH when needed for all platforms
  • Verify the installation with dart --version
  • Diagnose and fix common installation errors

Next Up: Now that Dart is installed, let's set up your IDE — VS Code or Android Studio — for a productive Dart development experience.

WhatsApp