Installing Sanity on a Mac via Terminal - helpful tips and instructions

11 replies
Last updated: May 12, 2022
i need help please. giving up on sanity already.. ijust dont know why its so frustrating installing sanity on my mAC via the terminal
AI Update

Don't give up! Installing Sanity can be frustrating at first, but it's usually a quick fix once we identify the issue. Here's what you need to know to get past this:

The most common issue on Mac is Node.js version compatibility. Sanity Studio v4 requires Node.js version 20 or higher. If you have an older version installed, that's likely causing your installation problems.

Here's how to get up and running:

  1. Check your Node.js version - Open Terminal and run:

    node -v

    If it shows anything below v20 (like v16 or v18), you need to update.

  2. Install or update Node.js - Go to nodejs.org and download the LTS (Long Term Support) version, which will be v20 or higher. The installer will handle everything for you on Mac.

  3. Verify npm is working - After installing Node, check that npm (the package manager) is also available:

    npm -v
  4. Create your Sanity project - Once Node.js 20+ is installed, you have two options:

    Option A (Recommended) - Use the modern command:

    npm create sanity@latest

    Option B - Use the traditional CLI approach:

    npm install -g sanity@latest
    sanity init

    Both commands will walk you through creating a new project with prompts for project name, dataset configuration, and template selection. The sanity init command provides an interactive setup that handles everything for you.

Common Mac-specific issues:

  • Permission errors: If you see EACCES or permission errors when installing globally, don't use sudo with npm. Instead, you can use npm create sanity@latest which doesn't require global installation, or configure npm to install packages globally without requiring sudo.

  • Path issues: Make sure Terminal can find the node and npm commands. Close and reopen Terminal after installing Node.js to refresh your environment.

  • Multiple Node versions: If you've installed Node multiple times or used different methods, consider using a version manager like nvm to manage versions cleanly.

After successful installation, you can start your studio with:

npm run dev

What specific error message are you seeing in Terminal? That would help narrow down exactly what's going wrong. But in most cases, ensuring you have Node.js 20+ installed properly solves the issue immediately. You're almost there!

Hey there! What sort of issues are you having?
thank you. it returns EACCESS .. and when I add sudo to the begining, it asks for a password… i dont know what the password should be.
The password will be the same on that you use to login to your computer.
Really sorry this is frustrating. Managing node can be rough for even seasoned web developers.
Here’s a detailed
recent article on installing node with nvm (node version manager) on mac.
Here’s my own quick and dirty that may help you:
1. install
Homebrew (note: the xcode tools download can take a while if you haven’t done this yet on your mac)2. instead of installing node with brew…
3. install nvm with brew:
brew install nvm
4. install the latest node “lts” version (
nvm instructions )5. check your node (
node -v
) and npm (
npm -v
) versions. Both should return something. If so, you’re ready to install the cli6. now install the sanity cli globally:
npm install -g @sanity/cli
7. check if the cli is installed:
sanity --help
should return a list of options8. go ahead and log into the sanity cli:
sanity login
- use your existing sanity account or create a new one if you haven’t yet9. NOW you should be good to go to create a new studio with
sanity init
or install modules in an existing studio with
sanity install
then
sanity start
to turn on your local dev server!
For more recent macOS versions, I do not think that you should need to run any of these commands with sudo and would avoid it unless the linked instructions say so.
running sudo with any of the brew, node, or npm module commands above might actually install things in a different directory than expected and cause unexpected results when you go to use the cli in your project
but I installed NODE already? downloaded it from the website and then installed it on my mac. Please Is there any additional installing process other than those I mentioned?
user M
thanks alot. I’ve got the password.
If this works for you, you should be good to continue.
check your node (
node -v
) and npm (
npm -v
) versions. Both should return something
Here are some quick commands from my computer to make sure everything is installed:
~
(✿◠‿◠)ノ node -v
v18.0.0

~
(✿◠‿◠)ノ npm -v
8.6.0

~
(✿◠‿◠)ノ sanity -v
@sanity/cli version 2.29.8

~
(✿◠‿◠)ノ npm -g list
/Users/jules/.nvm/versions/node/v18.0.0/lib
├── @sanity/cli@2.29.8
├── corepack@0.10.0
├── newman@5.3.2
└── npm@8.6.0
You're welcome
user F
! Were you able to complete your install?
user M
Yes I was. Thanks

Sanity – Build the way you think, not the way your CMS thinks

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.

Was this answer helpful?