zsh

How to Fix – zsh: command not found yarn Error on a Mac

Zsh is a command-line shell that comes preinstalled on macOS and offers a convenient way to run commands and manage applications. However, sometime when you try to use the “yarn” command in Zsh, you will get an error “zsh command not found”. This error occurs when zsh cannot find the yarn command among its available commands, preventing you to use the yarn-related commands on the terminal.

Follow the guide to learn how to fix zsh command not found yarn error in Mac.

How to Fix – zsh: command not found yarn Error on a Mac

The Zsh command not found yarn error occurs when the Zsh shell cannot locate the yarn command among its available commands. This can happen due to yarn not being properly installed on the system or the path to the yarn executable not being added to the Zsh configuration.

To fix the zsh command not found yarn error in the Mac terminal, follow the below-given steps.

Step 1: Check yarn Installation

The first step is to ensure that yarn is properly installed on your Mac and for that open the terminal and run the following command to check the yarn version:

yarn --version

 

The above command will generate the zsh command not found yarn error on the terminal.

Step 2: Install yarn on Zsh

To install yarn on Zsh through Homebrew, use the following command:

brew install yarn

 

You can also require installing yarn dependency node as well from the following command:

brew install node

 

Note: To run the brew command on a Mac you must have Homebrew installed, find a complete guide to installing Homebrew on a Mac here.

Step 3: Test the Changes

Once you have completed the above steps, test the yarn command in your Zsh.

yarn --version

 

If the command runs successfully and displays the yarn version, you have successfully fixed the error.

Conclusion

The zsh command not found yarn error can be frustrating when you are trying to use yarn in your Zsh terminal, however, by following the steps above, you can resolve the issue and start using yarn seamlessly.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.