Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Yarn on macOS

Install Homebrew, then install Yarn with one command and use it for your projects.

How-To Guides1 min read3 steps4 screenshots

Prerequisites

  1. A recent version of macOS.
  2. Homebrew, the package manager for macOS. Install it with:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Installing Homebrew
  1. Node.js. The Homebrew Yarn package installs it as a dependency if it is missing.

Step 1: Update Homebrew

brew update
Updating Homebrew

Step 2: Install Yarn

brew install yarn
Installing Yarn

Step 3: Check it

yarn --version
The Yarn version

Use Yarn

TaskCommand
Start a projectyarn init
Add a packageyarn add [package-name]
Remove a packageyarn remove [package-name]
Update packagesyarn upgrade
Run a scriptyarn run [script-name]

Example:

yarn run start

Best practices

  • Update Yarn regularly with brew upgrade yarn.
  • Commit the yarn.lock file so all developers use the same versions.
  • Use one package manager per project; do not mix npm and Yarn.

Quick recap

  • brew install yarn and yarn --version.