# 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.

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

| Scope | File | Applies to |
| --- | --- | --- |
| User | `~/.claude/settings.json` | You, in every project |
| Shared project | `.claude/settings.json` | Everyone in the folder, if committed |
| Project local | `.claude/settings.local.json` | You, in one project |
| Managed | `managed-settings.json`, MDM or server-managed | Everyone 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

```json
{
  "$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](https://www.excellent.so/guides/claude-code-permissions)
- **`sandbox`.** Off by default. [Sandbox guide](https://www.excellent.so/guides/claude-code-sandbox)
- **`hooks`.** Commands that run at session events, with your environment. [Hooks guide](https://www.excellent.so/guides/claude-code-hooks)
- **`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](https://code.claude.com/docs/en/settings) · [Managed settings](https://code.claude.com/docs/en/managed-settings) · [Permissions](https://code.claude.com/docs/en/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](https://www.excellent.so/scan) · [See a sample report](https://www.excellent.so/r/sample)

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](https://www.excellent.so/docs/sandbox) · [Pricing](https://www.excellent.so/pricing). For the Codex equivalent, see [Codex config.toml](https://www.excellent.so/guides/codex-config-toml).

Source: https://www.excellent.so/guides/claude-code-settings-json
