Installing the Dart SDK on Mac

We recommend using Homebrew to manage your Dart installation. Another option is downloading Dart manually.

Using Homebrew

With Homebrew, installing and updating Dart is easy. You can use the default location or specify a custom location for Dart. If you’re developing a web app, you should also install Dartium.

Installing the Dart SDK

The dart package contains the Dart SDK, which includes the Dart VM, libraries, and command-line Dart tools such as dart, dart2js, dartanalyzer, pub, and dartdocgen.

To install Dart, run:

$ brew tap dart-lang/dart
$ brew install dart

Updating the Dart SDK

To update Dart once you’ve installed it using Homebrew, run:

$ brew update
$ brew upgrade dart

Installing Dartium

The dartium package contains a special build of Chromium (nicknamed Dartium) that includes a Dart VM. Use it to test and debug Dart web apps without first compiling them to JavaScript.

To install Dartium, run:

$ brew tap dart-lang/dart
$ brew install dartium

To update Dartium, run:

$ brew update
$ brew upgrade dartium

Specifying a custom location

By default, Homebrew downloads to /usr/local, which might require using sudo to handle issues with file permissions. If you prefer, you can download to another location where you have write permissions, such as your home directory.

  1. Go to the directory above where you want Homebrew and Dart to live. For example, if you want Homebrew and Dart to live under ~/homebrew, go to ~.

    $ cd ~    # The directory that will contain Homebrew and Dart
    
  2. Clone Homebrew. This creates a homebrew directory.

    $ git clone https://github.com/Homebrew/homebrew.git
    
  3. Add the homebrew/bin directory to your PATH.

  4. Follow the brew instructions in Installing Dart. Dart will be installed under homebrew.

Downloading the Dart SDK manually

Follow these steps to download Dart manually. You’ll need to download it again whenever you need the latest APIs and bug fixes.

  1. Download the Dart SDK. Unzip the downloaded file to get the SDK.

  2. Add <sdk>/bin to your PATH.

  3. If you’re developing a web app, download Dartium. Unzip it to get a special version of Chromium with the Dart VM. This binary expires after 1 year. When that happens, you’ll need to download a new copy to continue using Dartium.