Installing and Configuring Pub

Pub is in the Dart SDK, which you can download by itself or as part of Dart Editor. You can use pub through Dart Editor, or through the pub command-line app, which lives inside the bin directory of the Dart SDK.

Get pub

Download Dart and unzip the ZIP file, which creates a dart directory.

Put dart/dart-sdk/bin in your PATH.

On Mac OS:

$ export PATH=$PATH:<installation directory>/dart/dart-sdk/bin

On Windows:

> set PATH=%PATH%;C:<installation directory>/dart/dart-sdk/bin

On Linux:

$ export PATH=${PATH}:<installation directory>/dart/dart-sdk/bin

Optional environment variables

Environment variables allow you to customize pub to suit your needs.

PUB_CACHE: Some of pub’s dependencies are downloaded to the pub cache. By default, this directory is located under .pub_cache in your home directory. You can use the PUB_CACHE environmant variable to specify another location. For more information, see The system package cache.

PUB_HOSTED_URL: Pub downloads dependencies from To specify the location of a particular mirror server, use the PUB_HOSTED_URL environment variable. For example:

PUB_HOSTED_URL = http://user:password@