Running Claude Code as a Separate User on macOS

Claude Code tutorial: Running Claude in yolo mode safely using macOS user isolation and ACLs for fine-grained directory access control
Claude Code
macOS
Security
Author

Jonathan Chang

Published

December 13, 2025

This guide explains how to run Claude Code as a separate macOS user account, giving you fine-grained control over which directories Claude can access — and allowing Claude to run in yolo mode safely.

TLDR

Run Claude Code as a user. Use ACL to give claude access to specific folders, and to make sure you can read/write files created by claude.

Motivation

I want to let Claude run in yolo mode (--dangerously-skip-permissions), but I also want to make sure it’ll never delete my home directory by accident.

Alternatives

  • Buy Claude a computer. I could let it run in a separate Mac mini[1][2] or a cloud instance. This makes sense for tasks where Claude needs privileged access, but for most coding tasks it’s unnecessary overhead.
  • Docker. Docker provides great isolation and probably matches the environment Claude is trained in, but it also adds friction to the workflow.
  • Claude Code/Codex builtin sandbox. These things evolve with each version. It has some limitations and it’s hard to keep track of how it works. (Claude Code is not open source). I just want to run --dangerously-skip-permissions!

Setup (tested on macOS)

1. Create the claude user

Use macOS System Settings → Users & Groups to create a new standard user named “claude”. You might need to login to the GUI as claude at least once for some things to work correctly (e.g. keychain).

2. Install Claude Code for the claude user

# Switch to claude user
su claude

# Install Claude Code
curl -fsSL https://claude.ai/install.sh | bash

3. (Optional) Allow passwordless sudo to claude

This lets you switch to the claude user without typing a password each time:

echo "$(whoami) ALL=(claude) NOPASSWD: ALL" | sudo EDITOR='tee -a' visudo -f /etc/sudoers.d/claude

4. Grant Claude access to a directory

# Set the directory you want to grant access to
DIR=/path/to/dir

# ACL permissions for full read/write/delete with inheritance
ACL_PERMS="allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit,delete"

# Grant claude access
chmod -R +a "user:claude $ACL_PERMS" "$DIR"
# Grant yourself access to files claude creates
chmod -R +a "user:$(whoami) $ACL_PERMS" "$DIR"

To revoke access:

chmod -R -a "user:claude $ACL_PERMS" "$DIR"
chmod -R -a "user:$(whoami) $ACL_PERMS" "$DIR"

This uses macOS ACLs (Access Control Lists) to grant the claude user access to specific folder, and to allow you to have r/w access to files created by claude.

Key ACL flags:

  • file_inherit, directory_inherit — new files/subdirectories inherit this ACL

  • list,add_file,search,add_subdirectory,delete_child,delete — full read/write/delete access

  • readattr,writeattr,readextattr,writeextattr,readsecurity — metadata access

5. Run Claude Code as claude

sudo -u claude -i bash -lc "cd '$(pwd)' && claude --dangerously-skip-permissions"

Usage

Once setup is complete (including the cc alias):

cd ~/path/to/your/project
cc

Appendix

Dedicated group (optional)

If you’re on a machine with multiple users and want to prevent other users from reading files created by claude, you can create a group and make it the primary group of claude, so files created by claude are in group claude, and is only readable by claude (user) and you (via ACL).

Group creation commands (click to expand)
# Create a group just for claude
NEXT_GID=$(($(dscl . list /Groups PrimaryGroupID | awk '{print $2}' | sort -n | tail -1) + 1))
sudo dscl . create /Groups/claude
sudo dscl . create /Groups/claude PrimaryGroupID $NEXT_GID
sudo dscl . append /Groups/claude GroupMembership claude
sudo dscl . create /Users/claude PrimaryGroupID $NEXT_GID

Git Setup

The claude user needs git configuration (name, email) to make commits. Copy your .gitconfig or set it up manually.

GitHub Setup

By default, claude can’t use your gh token, unless you make the token available to claude. This is desirable for security. You can review the code before pushing manually, or go one step further to setup a separate GitHub account/token for Claude.

Alternative: Group permissions and umask

I also tried using group permission (g+rw) and umask to manage file access, but it’s not as robust as ACL.

Issues with umask (click to expand)

Setting umask for the claude user:

echo 'umask 002' | sudo tee -a /Users/claude/.bash_profile

This sets a default so files created by claude are group-writable.

Issues with this approach:

  • Umask can be unreliable across different tools and contexts
  • Claude Code’s Write tool (as of v2.0.69) does not respect umask, meaning files created with the Write tool may not be accessible without manual permission fixes (sudo chown/chmod)
  • The ACL inheritance approach (shown above) is more reliable for ensuring you can access files claude creates

Troubleshooting

Troubleshooting commands (click to expand)

Check current ACLs on a directory

ls -le /path/to/dir

Verify claude can access a directory

sudo -u claude ls /path/to/dir

Clear all ACLs from a directory

chmod -RN /path/to/dir