This example explains the different methods to install Yarn for your OS.

macOS

Homebrew

brew update
brew install yarn

MacPorts

sudo port install yarn

Adding Yarn to your PATH

Add the following to your preferred shell profile (.profile, .bashrc, .zshrc etc)

export PATH="$PATH:`yarn global bin`"

Windows

Installer

First, install Node.js if it is not already installed.

Download the Yarn installer as an .msi from the Yarn website.

Chocolatey

choco install yarn

Linux

Debian / Ubuntu

Ensure Node.js is installed for your distro, or run the following

curl -sL <https://deb.nodesource.com/setup_6.x> | sudo -E bash -
sudo apt-get install -y nodejs

Configure the YarnPkg repository