Skip to content
← All guides

Claude Code settings.json: locations, precedence, key settings

Where Claude Code settings.json lives on a Mac, which scope wins, how lists merge, and the security-relevant keys to check, from the official docs.

4 min read

Claude Code reads settings from ~/.claude/settings.json (user), .claude/settings.json (shared project), .claude/settings.local.json (project local) and managed settings. Precedence, highest first, is managed, command line, project local, shared project, user. Installing Claude Code doesn’t create any of these files. Run /status to see which loaded.

Files and scopes

ScopeFileApplies to
User~/.claude/settings.jsonYou, in every project
Shared project.claude/settings.jsonEveryone in the folder, if committed
Project local.claude/settings.local.jsonYou, in one project
Managedmanaged-settings.json, MDM or server-managedEveryone your organization deploys it to

On macOS the managed file is /Library/Application Support/ClaudeCode/managed-settings.json, with an optional managed-settings.d/ directory beside it. The MDM route is the com.anthropic.claudecode managed preferences domain. A separate file, ~/.claude.json, holds account details, MCP server configuration and trust decisions, and the docs say you don’t need to edit it. CLAUDE_CONFIG_DIR moves the home-directory files.

Claude Code writes .claude/settings.local.json when you choose “Yes, and don’t ask again” on a Bash prompt, and adds it to your global git excludes. If you create it by hand, add it to .gitignore yourself.

How values combine

When the same key is set in several places, the highest level wins. List keys such as permissions.allow merge instead, so each file adds entries. A deny in any scope still beats an allow. To try a value for one session, pass --settings '<json or file>'. It sits above your files and below managed settings. Claude Code reloads most edits, including permissions and hooks, without a restart. Files must be strict JSON, so a comment or trailing comma is an error. Run claude doctor to list rejected entries.

Keys worth checking

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "defaultMode": "default",
    "deny": ["Read(./.env)", "Read(./.env.*)"],
    "disableBypassPermissionsMode": "disable"
  },
  "sandbox": { "enabled": true },
  "hooks": {},
  "env": {}
}
  • permissions. Rules and the default mode. Permissions guide
  • sandbox. Off by default. Sandbox guide
  • hooks. Commands that run at session events, with your environment. Hooks guide
  • env. Environment variables applied to sessions. Most project env values wait for folder trust. Telemetry export variables in env don’t take effect from project or local settings.
  • disableAllHooks, allowManagedHooksOnly, allowManagedPermissionRulesOnly. Lock keys for hooks and rules.

Keys a repository file can’t set

A committed .claude/settings.json is shared code, so some keys are limited. The docs say permissions.defaultMode values auto and bypassPermissions don’t take effect from project or local settings. permissions.allow rules, permissions.additionalDirectories, extraKnownMarketplaces and most env values apply only after you trust the folder. Deny and ask rules apply right away. Before you open an unfamiliar repository, read its .claude/settings.json for hooks and env.

Managed exceptions

Managed settings override everything, with a short list of restrictive exceptions. The docs list these as honored even when a managed source says otherwise. A true from any scope for permissions.blockReadsOutsideWorkingDirectories and permissions.blockWritesOutsideWorkingDirectories. A true for permissions.denyInsteadOfPrompting from ~/.claude/settings.json or --settings. A false for remoteControlAtStartup from project files.

Check the result

  1. Run /status and read the Setting sources line.
  2. Run /permissions to see each rule and its file.
  3. Run claude doctor for rejected entries.
  4. Open .claude/settings.json in any repository you clone before running Claude Code there.

Checked against the vendor documentation on November 25, 2026. Settings · Managed settings · Permissions

Where Excellent fits

Excellent’s free scan reads supported logs on the Mac and reports findings for review. It reads the session logs of Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code. Run the free scan · See a sample report

Excellent Pro adds checks before supported actions and can configure Claude Code’s and Codex’s native Mac sandboxes from your file and folder rules, with a plan to review first. Pro is US-only for now. Sandbox setup · Pricing. For the Codex equivalent, see Codex config.toml.

Related guides

View all