
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is a common issue on macOS with zsh! The problem is that npm's global binary directory isn't in your $PATH environment variable, so your shell can't find the sanity command.
Based on this community discussion about the exact same issue, the recommended solution is to use NVM (Node Version Manager) to manage your Node.js installation.
Install NVM by following the instructions at https://github.com/nvm-sh/nvm
Install Node.js through NVM:
nvm install 16 # or any recent version like 18, 20
nvm use 16Set the default Node version so you don't have to run nvm use every time you open a new terminal:
nvm alias default 16Reinstall the Sanity CLI:
npm install -g @sanity/cliNow the sanity command should work in any new terminal window!
When you install Node.js directly (not through NVM), the npm global binary path sometimes doesn't get properly added to your shell's $PATH. This is especially common on macOS with zsh. NVM handles this path configuration automatically and also makes it easier to manage multiple Node.js versions.
If you prefer to stick with your current Node.js installation, you can manually add the npm bin directory to your PATH:
npm bin -g to find your global npm bin directory (likely something like /Users/yourusername/node_modules/.bin)~/.zshrc file:export PATH="/Users/yourusername/node_modules/.bin:$PATH".bin part at the end!source ~/.zshrcHowever, using NVM is generally more reliable and is the approach recommended by the Sanity community for avoiding these types of PATH issues. Note that Sanity Studio v4 requires Node.js 20 or higher, so you'll want to use a recent Node version anyway.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store