On this page
Installing Dart
Windows
- Download the Dart SDK from the official Dart website.
- Extract the downloaded ZIP file to a location of your choice, for example,
C:\dart
. - Update your system’s
PATH
environment variable:- Open the Start Search, type in “env”, and select “Edit the system environment variables”.
- Click on the “Environment Variables” button.
- Under “System variables”, find the
PATH
variable, select it, and click “Edit”. - Add the path to the Dart SDK bin directory, for example,
C:\dart\dart-sdk\bin
.
- Open a new command prompt and run
dart --version
to verify the installation.
macOS
- Open a terminal.
- Install Homebrew if you haven’t already:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Use Homebrew to install Dart:
brew tap dart-lang/dart
brew install dart
- Verify the installation by running:
dart --version
Linux
Using apt
(Debian-based systems like Ubuntu)
- Open a terminal.
- Add the Dart APT repository:
sudo apt update
sudo apt 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 the Dart SDK:
sudo apt update
sudo apt install dart
- Verify the installation:
dart --version
Using yum (RHEL-based systems like CentOS, Fedora)
- Open a terminal.
- Add the Dart YUM repository:
sudo tee /etc/yum.repos.d/dart.repo << EOF
[dart]
name=Dart
baseurl=https://storage.googleapis.com/download.dartlang.org/linux/fedora/stable/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
EOF
- Install the Dart SDK:
sudo yum install dart
- Verify the installation:
dart --version