Installing the Dart SDK on Mac, Windows, and Linux involves different steps for each operating system. Below are instructions for each platform:

Mac:

  1. Homebrew (recommended):
  • Open Terminal.
  • Run the following commands:
    bash brew tap dart-lang/dart
    brew install dart
  1. Manual Installation:
  • Download the Dart SDK from the Dart SDK page: Dart SDK.
  • Extract the downloaded archive to a location of your choice.
  • Add the Dart SDK bin directory to your system’s PATH by adding the following line to your shell profile file (e.g., ~/.bash_profile or ~/.zshrc):
    bash export PATH="$PATH:/path/to/dart-sdk/bin"
  • Run source ~/.bash_profile (or source ~/.zshrc) to apply the changes.

Windows:

  1. Chocolatey (recommended):
  • Open Command Prompt or PowerShell as an administrator.
  • Run the following command:
    bash choco install dart-sdk
  1. Manual Installation:
  • Download the Dart SDK from the Dart SDK page: Dart SDK.
  • Extract the downloaded archive to a location of your choice.
  • Add the Dart SDK bin directory to your system’s PATH:
    • Right-click on “This PC” or “Computer” and select “Properties.”
    • Click on “Advanced system settings” and then “Environment Variables.”
    • Under “System variables,” find the “Path” variable and click “Edit.”
    • Add the path to the Dart SDK bin directory (e.g., C:\path\to\dart-sdk\bin).
    • Click “OK” to close the windows.

Linux:

  1. Using apt (for Debian-based systems like Ubuntu):
  • Open Terminal.
  • Run the following commands:
    bash sudo apt update sudo apt install apt-transport-https sudo sh -c ‘wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg –dearmor > /usr/share/keyrings/google-chrome-archive-keyring.gpg’ echo ‘deb [signed-by=/usr/share/keyrings/google-chrome-archive-keyring.gpg] https://dl-ssl.google.com/linux/chrome/deb/ stable main’ | sudo tee /etc/apt/sources.list.d/dart_stable.list > /dev/null sudo apt update sudo apt install dart
  1. Manual Installation (Generic Linux):
  • Download the Dart SDK from the Dart SDK page: Dart SDK.
  • Extract the downloaded archive to a location of your choice.
  • Add the Dart SDK bin directory to your system’s PATH by adding the following line to your shell profile file (e.g., ~/.bashrc or ~/.zshrc):
    bash export PATH=”$PATH:/path/to/dart-sdk/bin”
  • Run source ~/.bashrc (or source ~/.zshrc) to apply the changes.

After installing the Dart SDK, you can verify the installation by running dart --version in the terminal/command prompt, which should display the installed Dart version.

Spread the love

Join the Conversation

2 Comments

Leave a comment

In this article

Index