Installing the Dart SDK on Mac, Windows, and Linux involves different steps for each operating system. Below are instructions for each platform:
Mac:
- Homebrew (recommended):
- Open Terminal.
- Run the following commands:
bash brew tap dart-lang/dart
brew install dart
- 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’sPATH
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
(orsource ~/.zshrc
) to apply the changes.
Windows:
- Chocolatey (recommended):
- Open Command Prompt or PowerShell as an administrator.
- Run the following command:
bash choco install dart-sdk
- 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’sPATH
:- 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:
- 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
- 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’sPATH
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
(orsource ~/.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.
Leave a comment