Claude Code reads settings.json from four places, ~/.claude/settings.json (user), .claude/settings.json (shared project), .claude/settings.local.json (personal project) and a managed file deployed by your organization. Single values follow managed, command line, local, project, user precedence, while permission lists merge and deny rules always win.
Claude Code settings.json is the JSON file where you configure permissions, the default permission mode, hooks, the sandbox and most other behavior. There is not one file but four: a user file in ~/.claude/, a shared project file and a personal project file in .claude/, and a managed file your organization can deploy. This reference covers where each lives, which one wins, and copy-ready examples for permissions and hooks.
For the meaning of the permission rules themselves, see the complete guide to Claude Code permissions.
Where are the Claude Code settings.json files?
Claude Code reads settings from these files. Installing Claude Code does not create any of them; you create them, or Claude Code writes them when you save a setting or approve a prompt.
| Scope | Path | Who it affects |
|---|---|---|
| User | ~/.claude/settings.json | You, in every project on this machine |
| Shared project | .claude/settings.json | Everyone in the repository, once committed |
| Project local | .claude/settings.local.json | You, in this project only |
| Managed (macOS) | /Library/Application Support/ClaudeCode/managed-settings.json | Everyone the organization deploys it to |
| Managed (Linux, WSL) | /etc/claude-code/managed-settings.json | Same |
| Managed (Windows) | C:\Program Files\ClaudeCode\managed-settings.json | Same |
On Windows, ~/.claude means %USERPROFILE%\.claude. If you set the CLAUDE_CONFIG_DIR environment variable, Claude Code keeps the user files there instead. Managed settings can also arrive through MDM (the com.anthropic.claudecode preferences domain on macOS) or as server-managed settings from the claude.ai admin console.
Claude Code also keeps a separate ~/.claude.json for its own state: account details, MCP server configurations, per-project trust decisions and the options /config writes. You normally do not edit it by hand.
Which settings file wins?
When the same key is set in several Claude Code settings files, the highest level wins. From highest to lowest:
- Managed settings
- Command line, with
--settings <file-or-json>for one session - Project local,
.claude/settings.local.json - Shared project,
.claude/settings.json - User,
~/.claude/settings.json
List keys work differently. Arrays such as permissions.allow and permissions.deny are merged across all files, so each file adds entries without removing another file's. For permissions, the evaluation order then decides: deny first, then ask, then allow. A deny in your user file blocks an allow in the project file, and the reverse is also true.
A few restrictive keys are honored from a lower level even when managed settings say otherwise. For example, permissions.blockReadsOutsideWorkingDirectories set to true in any scope keeps the block on.
What does a basic settings.json look like?
A minimal Claude Code settings.json with permissions looks like this. The $schema line gives you autocomplete and validation in editors that support JSON Schema.
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [
"Bash(npm run lint)",
"Bash(npm run test *)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)"
]
}
}Settings files are strict JSON. A // comment or a trailing comma is a syntax error, and Claude Code reports it as a Settings Error at the next start. A single malformed entry, such as a broken permission rule, is reported as a Settings Warning and skipped while the rest of the file stays in effect.
Which permission keys can I set?
These are the permission keys you will use most in Claude Code settings.json, all under the permissions object unless noted:
| Key | What it does |
|---|---|
allow | Rules that run without a prompt |
ask | Rules that always prompt |
deny | Rules that are blocked |
additionalDirectories | Extra directories Claude can read and edit |
defaultMode | The permission mode new sessions start in |
disableBypassPermissionsMode | Set to "disable" to block bypass mode |
disableAutoMode | Set to "disable" to remove auto mode |
denyInsteadOfPrompting | true denies calls that would wait on a prompt |
blockReadsOutsideWorkingDirectories | true makes file tools refuse reads outside the working directories |
blockWritesOutsideWorkingDirectories | true makes Write, Edit and NotebookEdit refuse writes outside them |
allowManagedPermissionRulesOnly (top level, managed only) | Only managed settings can define permission rules |
A fuller example for a team's committed .claude/settings.json:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"defaultMode": "acceptEdits",
"allow": [
"Bash(npm test)",
"Bash(npm run build)",
"Bash(git diff *)",
"Bash(git commit *)",
"WebFetch(domain:docs.github.com)"
],
"ask": [
"Bash(git push *)"
],
"deny": [
"Bash(curl *)",
"Read(./secrets/**)"
],
"additionalDirectories": ["../shared-lib/"]
}
}Two scope rules to remember. First, allow rules and additionalDirectories in a committed project file only apply after each person accepts the workspace trust dialog; deny and ask rules apply right away. Second, defaultMode values "auto" and "bypassPermissions" are ignored in project and local files, so set those in your user file if you want them. The permission modes guide explains each mode, and how to allow specific commands covers rule syntax and a safe allowlist.
How do I configure hooks in settings.json?
Claude Code hooks live under a top-level hooks key. Each event name maps to a list of matcher groups, and each group has one or more handlers. For tool events, matcher matches the tool name.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/check-bash.sh"
}
]
}
]
}
}Event names include PreToolUse, PermissionRequest, PostToolUse, Notification, Stop, SessionStart and SessionEnd, among others. The ones that matter for permissions:
- PreToolUse runs before the permission prompt. It can return
allow,deny,askordeferthroughhookSpecificOutput.permissionDecision. Exit code 2 blocks the call. - PermissionRequest runs when Claude Code is about to show you a permission prompt, and can allow or deny it through a
decisionobject withbehavior. - Notification runs on notifications, with matchers such as
permission_promptandidle_prompt.
Hooks never override your deny and ask rules: those are evaluated whatever a PreToolUse hook returns. To turn all hooks off temporarily without deleting them, set "disableAllHooks": true. The Claude Code hooks guide and the PermissionRequest hook guide have complete scripts.
Hooks in a project's settings file run commands on your machine. Read a repository's .claude/settings.json before you trust the folder, and see the coding agent security checklist.
How do I enable the sandbox in settings.json?
Claude Code's sandbox runs shell commands inside an OS-level boundary with restricted writes and a network allowlist. Enable it with /sandbox in a session or in settings:
{
"sandbox": {
"enabled": true,
"network": {
"allowedDomains": ["github.com", "*.npmjs.org"]
}
}
}The sandbox is off by default. On macOS it uses Seatbelt; on Linux and WSL2 it needs bubblewrap and socat installed. It covers shell commands and their child processes, not hooks, MCP servers or the file tools.
How do I check which settings Claude Code loaded?
Run /status in a Claude Code session and read the Setting sources line. It lists each settings file loaded for the session, and shows how managed settings reached your machine if they apply.
Other useful checks:
/permissionslists every permission rule and the file it came from.claude doctorlists settings entries Claude Code rejected.claude --settings '{"disableAllHooks": true}'tests a value for one session without saving it.
Claude Code watches its settings files and reloads most edits, including permissions and hooks, without a restart. A few keys such as model are read only at session start.
Where Allowbar fits in your settings
Allowbar is a Mac menu bar app for Claude Code and Codex that connects through the agents' own hooks. For Claude Code, it adds its hook entries to ~/.claude/settings.json and leaves your other settings and hooks untouched. Hook events go to a small local server on the Mac; nothing is sent to a cloud service.
With that in place, when Claude Code asks for permission, a panel slides down from the top of the screen with the project, the tool and the exact command, and you answer Allow, Block or Terminal. Allowbar never approves on its own and adds no allow rules. Commands your own allow rules already cover never show up, and if you do not answer before the countdown ends or the app is closed, the question goes back to the terminal.
Allowbar needs macOS 14 or later and is in private beta. Join the waitlist; the launch price is $9.99 instead of $29.90.
Sources:
- Settings files and precedence, Claude Code docs
- Deploy managed settings, Claude Code docs
- Configure permissions, Claude Code docs
- Hooks reference, Claude Code docs
- Sandboxing, Claude Code docs
Frequently asked questions
Where is the Claude Code settings.json on Mac?
Your personal file is ~/.claude/settings.json. Project files are .claude/settings.json and .claude/settings.local.json inside the project. Managed settings on macOS live at /Library/Application Support/ClaudeCode/managed-settings.json.
Should I commit .claude/settings.local.json?
No. It holds your personal rules for one project, including the ones Claude Code saves when you choose "Yes, and don't ask again". The first time Claude Code writes it in a git repository, it adds it to your global git excludes; if you created it by hand, add it to .gitignore yourself.
Why is my settings.json being ignored?
Check /status to see whether the file loaded. Common causes are invalid JSON, a higher level setting the same key, a project allow rule waiting for workspace trust, or a key that is not allowed in that file, such as defaultMode: "bypassPermissions" in a project file.
Do I need to restart Claude Code after editing settings.json?
Usually not. Claude Code reloads its settings files when they change, including permissions and hooks. A few keys, such as model, are read only when a session starts.
Can I put comments in Claude Code settings.json?
No. Settings files are strict JSON, so comments and trailing commas cause a Settings Error. Use the $schema line for editor validation instead.