Yarn Installation
suggest changeThis 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
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Install Yarn
sudo apt-get update && sudo apt-get install yarn
CentOS / Fedora / RHEL
Install Node.js if not already installed
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
Install Yarn
sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
sudo yum install yarn
Arch
Install Yarn via AUR.
Example using yaourt:
yaourt -S yarn
Solus
sudo eopkg install yarn
All Distributions
Add the following to your preferred shell profile (.profile
, .bashrc
, .zshrc
etc)
export PATH="$PATH:`yarn global bin`"
Alternative Method of Installation
Shell script
curl -o- -L https://yarnpkg.com/install.sh | bash
or specify a version to install
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version [version]
Tarball
cd /opt
wget https://yarnpkg.com/latest.tar.gz
tar zvxf latest.tar.gz
Npm
If you already have npm installed, simply run
npm install -g yarn
Post Install
Check the installed version of Yarn by running
yarn --version
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents