Installing and Configuring Pub

Send feedback

Pub is one of the tools in the Dart SDK.

You can use pub through an IDE, such as WebStorm, or through the pub command-line app, which lives inside the bin directory of the Dart SDK.

Get pub

Once you have installed the Dart SDK, add the SDK’s bin directory to your PATH.

On Mac OS:

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

On Windows:

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

On Linux:

$ export PATH=${PATH}:<installation-directory>/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 (on Mac and Linux), or in AppData\Roaming\Pub\Cache (on Windows). 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@