flutter
/

Dart Installation Guide: Setup Dart SDK on Windows, macOS & Linux

Last Sync: Today

On this page

15
0%
5 min read
Remaining
5 minleft

Click any section to jump — progress syncs automatically

flutter

Dart Installation Guide: Setup Dart SDK on Windows, macOS & Linux

Installing Dart SDK – Overview

Before you start coding in Dart, you need to install the Dart SDK (Software Development Kit). The Dart SDK includes the Dart VM, core libraries, development tools like dart and dartfmt, and the package manager pub. This guide will walk you through installing Dart on Windows, macOS, and Linux, and then verifying the installation with a simple 'Hello World' program.

Prerequisites

    • A computer running Windows (7 or later), macOS (10.15+), or a modern Linux distribution.
    • Administrator/sudo access (for system‑wide installation).
    • Internet connection to download the SDK.
    • (Optional) A code editor like VS Code or IntelliJ IDEA for a better development experience.

Method 1: Installing Dart via Official Installer (Windows & macOS)

The easiest way to install Dart on Windows and macOS is by using the official installer from the Dart website.

Windows Installation

    1. Visit the Dart SDK archive page.
    1. Download the latest stable Windows installer (e.g., dart-sdk-3.x.x-windows-x64.zip).
    1. Extract the ZIP file to a folder, for example C:\dart-sdk.
    1. Add the SDK bin directory to your system PATH:
    • Open System Properties → Environment Variables.
    • Under 'System variables', find Path, click Edit, then New.
    • Add C:\dart-sdk\bin and click OK.
    1. Open a new Command Prompt and verify the installation by running dart --version.

macOS Installation

    1. Download the macOS installer from the Dart SDK archive (choose the .pkg file).
    1. Open the downloaded .pkg file and follow the on‑screen instructions.
    1. The installer automatically adds Dart to your PATH.
    1. Open Terminal and verify with dart --version.

Method 2: Installing via Package Manager (Recommended for Linux & macOS)

Using a package manager simplifies updates and dependency management.

macOS with Homebrew

BASHRead-only
1
# Install Homebrew first (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Then install Dart
brew tap dart-lang/dart
brew install dart

Linux (Debian/Ubuntu) with apt

BASHRead-only
1
# Enable the Dart repository
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'

# Install Dart
sudo apt-get update
sudo apt-get install dart

After installation, you may need to add Dart to your PATH. For Debian/Ubuntu, the SDK is usually installed in /usr/lib/dart/bin. Add it to your shell profile:

BASHRead-only
1
export PATH="$PATH:/usr/lib/dart/bin"

Verifying Installation

Open a terminal (or command prompt) and run:

BASHRead-only
1
dart --version

You should see output similar to Dart SDK version: 3.x.x (stable). If the command is not found, double‑check that the SDK bin directory is in your PATH.

Your First Dart Program

Create a file named hello.dart with the following content:

DARTRead-only
1
void main() {
  print('Hello, Dart!');
}

Run it using the Dart VM:

BASHRead-only
1
dart hello.dart

If everything is set up correctly, you'll see Hello, Dart! printed in the console.

Setting Up an Editor

While you can write Dart code in any text editor, using an IDE with Dart support greatly improves productivity. Here's how to set up two popular editors:

Visual Studio Code

    1. Download and install VS Code.
    1. Open VS Code and go to the Extensions view (Ctrl+Shift+X).
    1. Search for 'Dart' and install the official Dart extension by Dart Code.
    1. Create a new folder for your project, then create a hello.dart file.
    1. You can now run the program by opening the file and pressing F5 (or selecting Run → Start Debugging).

IntelliJ IDEA / Android Studio

    1. Install IntelliJ IDEA Community Edition (or Android Studio).
    1. Launch the IDE and go to File → Settings → Plugins (or IntelliJ IDEA → Preferences on macOS).
    1. Search for 'Dart' and install the Dart plugin.
    1. Restart the IDE.
    1. Create a new Dart project (File → New → Project → Dart).
    1. Write your code and click the green Run button.

Troubleshooting Common Issues

    • 'dart' is not recognized as an internal or external command – The SDK bin folder is not in your PATH. Re‑check the PATH variable and restart your terminal.
    • Permission denied on Linux – If you installed via the Debian package, you might need to run sudo for certain operations, but normal user commands should work after PATH is set correctly.
    • Firewall blocking downloads – Ensure your network allows connections to Google's servers (for the apt repository) or the Dart website.

Next Steps

Now that Dart is installed, you can explore the language fundamentals:

    • Learn basic syntax in the Dart Introduction
    • Practice with variables and data types
    • Try writing simple programs using functions and control flow
    • Explore the official Dart documentation

Try it yourself

void main() {
  print('Welcome to Dart!');
}

Test Your Knowledge

Q1
of 4

Which command verifies that Dart SDK is correctly installed?

A
dart check
B
dart --version
C
dart verify
D
dart install
Q2
of 4

On Windows, after extracting the Dart SDK, what must you do to use 'dart' from any command prompt?

A
Run dart.exe directly
B
Add the SDK's bin folder to the PATH environment variable
C
Install Visual Studio
D
Restart the computer
Q3
of 4

Which package manager can be used to install Dart on macOS?

A
apt
B
yum
C
Homebrew
D
choco
Q4
of 4

What is the file extension for Dart source files?

A
.dart
B
.d
C
.dt
D
.da

Frequently Asked Questions

What are the system requirements for Dart SDK?

Dart SDK requires a 64‑bit operating system: Windows 7 or later, macOS 10.15 or later, or a modern Linux distribution (like Ubuntu 18.04+, Debian 10+, Fedora, etc.). At least 1 GB of free disk space and 2 GB of RAM are recommended.

How do I check if Dart is already installed on my system?

Open a terminal (Command Prompt on Windows) and run dart --version. If Dart is installed, you'll see the version number. If not, you'll get an error like 'dart: command not found'.

How can I update Dart to the latest version?

If you used a package manager (Homebrew, apt), run the respective update commands: brew upgrade dart on macOS, sudo apt update && sudo apt upgrade dart on Debian/Ubuntu. If you installed manually, download the latest SDK and replace the old folder, then update your PATH if necessary.

Can I install multiple Dart versions side by side?

Yes, you can install different versions in separate directories and switch by changing your PATH environment variable. Tools like fvm (Flutter Version Management) can also help manage multiple Dart/Flutter SDK versions.

Which Dart version should I download – stable or dev?

For most users, the stable version is recommended. It has been thoroughly tested and is suitable for production use. The dev version includes upcoming features but may be less stable. Choose dev only if you need to test new functionality.

Do I need to install Flutter separately if I want to develop Flutter apps?

Yes, Flutter includes its own Dart SDK. If you install Flutter, you don't need to install Dart separately. However, for pure Dart projects (command‑line, server, web), installing the standalone Dart SDK is sufficient.

How do I uninstall Dart SDK?

On Windows, delete the SDK folder and remove its bin directory from your PATH. On macOS, if installed via Homebrew, run brew uninstall dart. If installed via the .pkg installer, there's no automatic uninstaller – you can delete the SDK folder (usually /usr/local/opt/dart or /Library/dart) and remove PATH entries from your shell profile. On Linux (Debian/Ubuntu), run sudo apt remove dart.

Why do I get 'dart: command not found' after installation?

This usually means the SDK's bin directory is not in your system's PATH. Check your installation folder and add the correct path to your PATH environment variable (Windows) or shell profile (macOS/Linux). After adding, restart your terminal.

How do I set up Dart on other Linux distributions (Fedora, Arch)?

For Fedora, you can use the COPR repository: sudo dnf copr enable kalev/ghc then sudo dnf install dart. For Arch Linux, Dart is available in the AUR: use an AUR helper like yay -S dart. Alternatively, you can always download the SDK archive from dart.dev and configure PATH manually.

Previous

dart introduction

Next

dart syntax

Related Content

Need help?

Explore our comprehensive docs or start a chat with our tech experts.