Installing Dart
Set up the Dart SDK on your development machine.
What is it?
Dart installation involves downloading and configuring the Dart Software Development Kit (SDK) on your operating system. The SDK includes:
- The
dartcommand-line tool - The
pubpackage manager - The Dart runtime
- Core libraries and tools
Why does it exist?
You need to install Dart to:
- Compile and run Dart programs
- Manage dependencies with pub
- Use the Dart development tools
- Build Flutter applications
- Access the standard library
Installation Methods
Windows
Using Chocolatey (Recommended)
# Install Chocolatey first if needed
# Then install Dart
choco install dart-sdk
Using the installer
- Download the Dart SDK from dart.dev/get-dart
- Run the installer
- Follow the installation wizard
- Add the Dart SDK bin directory to your PATH
Using winget
winget install Dart.Dart
macOS
Using Homebrew (Recommended)
# Install Homebrew first if needed
brew tap dart-lang/dart
brew install dart
Using the installer
- Download the Dart SDK from dart.dev/get-dart
- Open the downloaded
.dmgfile - Drag the Dart SDK to your Applications folder
- Add the SDK bin directory to your PATH
Manual installation
# Download and extract
curl -O https://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-macos-x64-release.zip
unzip dartsdk-macos-x64-release.zip
mv dart-sdk /usr/local/dart-sdk
# Add to PATH
echo 'export PATH="$PATH:/usr/local/dart-sdk/bin"' >> ~/.zshrc
source ~/.zshrc
Linux
Using apt (Ubuntu/Debian)
# Add the official repository
sudo apt-get update
sudo apt-get install apt-transport-https
# Setup repository
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
Using snap
# Install via snap
sudo snap install dart --classic
Using brew (Linux)
# Install Homebrew first
brew tap dart-lang/dart
brew install dart
Manual installation
# Download and extract
wget https://storage.googleapis.com/dart-archive/channels/stable/release/latest/sdk/dartsdk-linux-x64-release.zip
unzip dartsdk-linux-x64-release.zip
sudo mv dart-sdk /usr/local/dart-sdk
# Add to PATH
echo 'export PATH="$PATH:/usr/local/dart-sdk/bin"' >> ~/.bashrc
source ~/.bashrc
VS Code Extension (Optional)
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Dart"
- Install the "Dart" extension by Dart Code
- Install "Flutter" extension if building Flutter apps
IntelliJ IDEA (Optional)
- Open IntelliJ IDEA
- Go to Settings > Plugins
- Search for "Dart"
- Install the Dart plugin
- Restart the IDE
- Configure the SDK path
Verify Installation
Check the version
dart --version
Expected output:
Dart SDK version: 3.x.x (stable)
Check the path
which dart
Expected output:
/usr/local/dart-sdk/bin/dart
# or similar path
Run a test program
Create a file called hello.dart:
void main() {
print('Hello, World!');
}
Run it:
dart hello.dart
Expected output:
Hello, World!
Common Issues
'dart' command not found
Solution:
- Ensure the Dart SDK bin directory is in your PATH
- Restart your terminal after installation
- On Windows, check that the installation path is correct
Permission denied on Linux/macOS
Solution:
chmod +x /usr/local/dart-sdk/bin/dart
Version mismatch
Solution:
- Update to the latest stable version
- Check if multiple versions are installed
- Use
dart --versionto confirm the active version
Installing Flutter (Optional)
If you plan to use Flutter:
# Follow Flutter installation guide
flutter doctor
Dart is included with Flutter, so you don't need to install it separately.
Best Practices
- Use the stable channel for production work
- Consider using version managers like
fvmfor Flutter projects - Keep Dart updated to the latest stable version
- Use
dart upgradeto update to the latest version - Add
dart/binto your system PATH
Summary
Installing Dart is straightforward on all major platforms. Choose the method that works best for your development environment. After installation, verify it works by running a simple program. The SDK includes everything you need to start developing Dart applications.
Next Steps
Now that Dart is installed, continue to:
Did You Know?
- The Dart SDK is about 200-400 MB depending on the platform
- Dart can be installed without admin privileges using the zip/tar archives
- The SDK includes a built-in package manager called
pub - Dart updates are released approximately every 6 weeks
- You can run Dart code directly from the web using DartPad