For Mac users, it is indeed a great platform and most people used it seamlessly on their systems. However, some users may encounter “zsh: command not found: sanity” error in Zsh while running the sanity-related commands.
Read this guide thoroughly to find solutions to fix the “zsh: command not found: sanity” error in Zsh on Mac.
How to Fix “zsh: command not found: sanity” Error in Zsh on Mac
While using Zsh on Mac, you may encounter a similar error when you try to run sanity-related commands:
This type of error indicates that the application is not installed on your system or the path variable is not set correctly. The ideal way to fix the issue is to install Sanity CLI on your Mac system because in most cases, the problem will be fixed as the installation automatically set the PATH in Zsh.
How to Install Sanity CLI on Mac?
The ideal and effective way to install Sanity CLI on Mac is to use the services of Node Package Manager (NPM).
How to Install NPM on Mac?
You can install NPM on your Mac system by visiting the official website and downloading the .pkg file with a single click on the Apple icon.
Once the .pkg file is downloaded, you have to run this file and follow the onscreen installation to complete the NPM installation on Mac.
Go back to your terminal to ensure NPM is successfully installed on Mac by running the following command:
How to Install Sanity CLI from NPM on Mac?
You can now install Sanity CLI globally from NPM on Mac by running the following command:
Once done, you can use the sanity-related command to ensure the error is fixed.
Here, I have used the version command to ensure Sanity CLI is installed on the system.
Alternatively, you can also use the following command to ensure it is there in the bin directory of your system.
Conclusion
Getting the “zsh: command not found: sanity” error will hinder our progress in interacting with the Sanity platform from Zsh. However, with an easy fix which is installing Sanity CLI from NPM, you can seamlessly use sanity-related commands on your terminal. The above guide has provided the methods to install NPM on Mac, then install Sanity CLI through NPM to fix the “zsh: command not found: sanity” in Zsh on Mac.