Installation Locations for User, Project, Local, and Enterprise Settings in Claude Code

Claude Code stores configuration in .claude directories across four distinct scopes: user-level at ~/.claude/settings.json, project-level at <project-root>/.claude/settings.json, local-level at <project-root>/.claude/settings.local.json, and enterprise-level in OS-specific system directories.

The davila7/claude-code-templates repository provides a CLI tool that manages these installation locations through an interactive installer. When you run commands like cct --setting allow-npm-commands, the tool prompts you to select exactly where the configuration should be persisted, with each location serving a specific visibility and governance purpose.

File System Paths for Each Installation Location

The CLI supports four distinct destinations that determine who can access the settings and whether they are committed to version control.

User Settings

User settings apply globally to all projects for the current OS user. These are stored in:

~/.claude/settings.json

This location is chosen via the "🏠 User settings" option in the interactive prompt. According to the source code in cli-tool/src/index.js (lines 822-837), this path is resolved using the user's home directory and is ideal for personal preferences that should follow you across every codebase.

Project Settings

Project settings are shared with the entire team and committed to version control. These reside at:

<project-root>/.claude/settings.json

Select this with the "📁 Project settings" option. Since this file lives within the repository, any team member cloning the project inherits these defaults, making it the standard choice for team-wide conventions.

Local Settings

Local settings (the default choice) are personal to the developer and excluded from version control. The path is:

<project-root>/.claude/settings.local.json

This is selected with the "⚙️ Local settings" option. Use this for experimental configurations or personal overrides that you do not want to push to shared repositories.

Enterprise Managed Settings

Enterprise settings are enforced by administrators across all users on a machine or domain. These use OS-specific system directories rather than the .claude subdirectory:

This location is selected with the "🏢 Enterprise managed settings" option. As implemented in cli-tool/src/index.js (lines 860-889), the CLI detects the operating system and writes directly to these protected directories, requiring administrator privileges.

How the CLI Resolves Installation Locations

When the installer runs, it builds a list of selected locations (installLocations). For each entry, the code in cli-tool/src/index.js executes the following logic:

  1. Sets currentTargetDir and settingsFile based on the chosen location type.
  2. For enterprise installations, detects the OS platform and selects the appropriate system directory (lines 866-883).
  3. Creates the directory using fs.ensureDir—enterprise directories are created directly without a .claude subfolder, while user, project, and local settings are nested under .claude.
  4. Reads existing JSON, merges new settings with conflict handling, and writes the result back to disk.

The enterprise resolution logic explicitly maps platforms to paths:

if (installLocation === 'enterprise') {
  const os = require('os');
  const platform = os.platform();

  if (platform === 'darwin') {
    // macOS
    currentTargetDir = '/Library/Application Support/ClaudeCode';
    settingsFile = 'managed-settings.json';
  } else if (platform === 'linux' || (process.platform === 'win32' && process.env.WSL_DISTRO_NAME)) {
    // Linux / WSL
    currentTargetDir = '/etc/claude-code';
    settingsFile = 'managed-settings.json';
  } else if (platform === 'win32') {
    // Windows
    currentTargetDir = 'C:\\ProgramData\\ClaudeCode';
    settingsFile = 'managed-settings.json';
  } else {
    // Fallback – treat as a normal user setting
    currentTargetDir = require('os').homedir();
    settingsFile = 'settings.json';
  }

  console.log(chalk.yellow(`⚠️  Enterprise settings require administrator privileges.`));
  console.log(chalk.gray(`📍 Target path: ${path.join(currentTargetDir, settingsFile)}`));
}

This excerpt from lines 866-889 of cli-tool/src/index.js shows how the tool handles cross-platform path resolution before writing managed enterprise configurations.

Writing Settings Programmatically

To bypass the interactive prompt in CI/CD pipelines or automation scripts, use the sharedInstallLocations option with the installIndividualSetting function:

// Programmatic usage inside another Node script
await installIndividualSetting('allow-npm-commands', process.cwd(), {
  sharedInstallLocations: ['enterprise'], // Options: 'user', 'project', 'local', 'enterprise'
  silent: true
});

This allows you to specify exactly which installation locations should receive the setting without user intervention. The function handles path resolution and file merging identically to the interactive CLI flow.

Summary

  • User settings live at ~/.claude/settings.json and follow the developer across all projects.
  • Project settings reside at <project-root>/.claude/settings.json and should be committed for team sharing.
  • Local settings default to <project-root>/.claude/settings.local.json for personal, uncommitted overrides.
  • Enterprise settings are written to OS-specific system directories (/Library/Application Support/ClaudeCode, /etc/claude-code, or C:\ProgramData\ClaudeCode) and require administrative privileges.
  • The mapping logic lives in cli-tool/src/index.js (lines 822-889), with enterprise path resolution occurring at lines 866-889.

Frequently Asked Questions

What happens if I select multiple installation locations during installation?

The CLI supports selecting multiple locations simultaneously. When you choose "user", "project", "local", or "enterprise" in any combination, the installer iterates over sharedInstallLocations and writes the setting to each specified path, merging with existing JSON files to prevent overwrites.

Why do enterprise settings require administrator privileges?

Enterprise settings are written to system-wide directories (/Library/Application Support/, /etc/, or C:\ProgramData\) that are protected by the operating system. As shown in the source code at lines 866-889 of cli-tool/src/index.js, these paths exist outside the user home directory and require elevated permissions to create directories and modify files.

Can I change the installation location after a setting is already installed?

Yes. You can re-run the installation command (e.g., cct --setting allow-npm-commands) and select a different location. The CLI will write the setting to the new location while preserving any existing configuration at the previous location, or you can manually move the JSON values between files following the path structures defined in the repository.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →