Installation

Before you start using Yarn, you'll first need to install it on your system. There is a growing number of different ways to install Yarn:

Select your platform above

macOS

You will need to first install Node.js if you don’t already have it installed.

Homebrew

You can install Yarn through the Homebrew package manager. This will also install Node.js if it is not already installed.

brew update
brew install yarn

Installation Script

One of the easiest ways to install Yarn on macOS and generic Unix environments is via our shell script. You can install Yarn by running the following code in your terminal:

curl -o- -L https://yarnpkg.com/install.sh | bash

Manual Install via tarball

You can install Yarn by downloading a tarball and extracting it anywhere.

cd /opt
wget https://yarnpkg.com/latest.tar.gz
tar zvxf yarn-*.tar.gz
# Yarn is now in /opt/yarn-[version]/

Path Setup

You will need to set up the PATH environment variable in your terminal to have access to Yarn’s binaries globally.

Add export PATH="$HOME/.yarn/bin:$PATH" to your profile (this may be in your .profile, .bashrc, .zshrc, etc.)

Windows

There are two options for installing Yarn on Windows.

Download the installer

This will give you a .msi file that when run will walk you through installing Yarn on Windows.

If you use the installer you will first need to install Node.js.

Download Installer

Install via Chocolatey

A Chocolatey package is coming soon!

Note: Yarn is currently incompatible with installation via Ubuntu on Windows awaiting a resolution to 468

Path Setup

You will need to set up the PATH environment variable in your terminal to have access to Yarn’s binaries globally.

Add set PATH=%PATH%;C:\.yarn\bin" to your shell environment.

Debian/Ubuntu Linux

On Debian or Ubuntu Linux, you can install Yarn via our Debian package repository. You will first need to configure the repository:

sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

On Ubuntu 14.04 and Debian Stable, you will also need to configure the NodeSource repository to get a new enough version of Node.js (Debian Testing and Ubuntu 16.04 come packaged with a sufficient version of Node.js, so this step is not required in those environments)

Then you can simply:

sudo apt-get update && sudo apt-get install yarn

CentOS / Fedora / RHEL

On CentOS, Fedora and RHEL, you can install Yarn via our RPM package repository.

sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo

If you do not already have Node.js installed, you should also configure the NodeSource repository:

curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -

Then you can simply:

sudo yum install yarn

Arch Linux

On Arch Linux yarn can be installed through the AUR.

If you use an AUR Helper such as yaourt you can simply run:

yaourt -S yarn

Solus

On Solus, you can install yarn via the Solus repository.

sudo eopkg install yarn

Path Setup

You will need to set up the PATH environment variable in your terminal to have access to Yarn’s binaries globally.

Add export PATH="$HOME/.yarn/bin:$PATH" to your profile (this may be in your .profile, .bashrc, .zshrc, etc.)

Alternatives

If you are using another OS or one of the other options specific to your OS will not work for you, there are a couple of alternatives. You will need to install Node.js if you don’t already have it installed.

On common Linux distributions such as Debian, Ubuntu and CentOS, it is recommended to install Yarn via our packages instead.

Installation Script

One of the easiest ways to install Yarn on macOS and generic Unix environments is via our shell script. You can install Yarn by running the following code in your terminal:

curl -o- -L https://yarnpkg.com/install.sh | bash

Manual Install via tarball

You can install Yarn by downloading a tarball and extracting it anywhere.

cd /opt
wget https://yarnpkg.com/latest.tar.gz
tar zvxf yarn-*.tar.gz
# Yarn is now in /opt/yarn-[version]/

Install via npm

You can also install Yarn through the npm package manager if you already have it installed. If you already have Node.js installed then you should already have npm.

Once you have npm installed you can run:

npm install --global yarn

Path Setup

Unix/Linux/macOS

You will need to set up the PATH environment variable in your terminal to have access to Yarn’s binaries globally.

Add export PATH="$HOME/.yarn/bin:$PATH" to your profile (this may be in your .profile, .bashrc, .zshrc, etc.)

Windows

You will need to set up the PATH environment variable in your terminal to have access to Yarn’s binaries globally.

Add set PATH=%PATH%;C:\.yarn\bin" to your shell environment.

Test that Yarn is installed by running:

yarn --version

Problems? If you are unable to install Yarn with any of these installers, please search through GitHub for an existing issue or open a new one.

Search for an existing issue · Open a new issue

← Previous: Getting Started Next: Usage