WORKFLOW

A good Mac setup for running coding agents every day

A practical Mac setup for running Claude Code and Codex daily, covering terminal, tmux, git worktrees, notifications, usage, secrets and sleep settings.

Short answer

A good Mac setup for Claude Code and Codex uses a terminal that supports desktop notifications (Ghostty, iTerm2 or Kitty), one git worktree per parallel agent, notifications for prompts and finished tasks, a regular usage check, deny rules and the sandbox to keep secrets out of reach, and caffeinate so long tasks are not cut off by sleep.

Claude Code and Codex run in any macOS terminal with no setup, but a few choices make daily use much smoother: you notice prompts sooner, parallel agents stop stepping on each other, and long tasks do not die when the Mac goes to sleep.

This guide walks through a setup that works well for running agents every day, one layer at a time. Everything here uses built-in macOS tools or the agents' own documented settings.

Which terminal should I use for Claude Code on a Mac?

Use a terminal that Claude Code can send desktop notifications to: Ghostty, iTerm2 or Kitty. According to the terminal configuration docs, Claude Code sends a desktop notification in these three when it detects them, while Apple Terminal gets a bell character at most and other terminals get nothing by default.

TerminalNotifications by defaultShift+Enter for newline
GhosttyDesktop notificationWorks
iTerm2Desktop notification, after enabling its alert settingsWorks
KittyDesktop notificationWorks
WezTerm, WarpNothing, use a hook or the bellWorks
Apple TerminalSilent bell unless Audible bell is onCtrl+J or \ then Enter always work
VS Code or Cursor terminalNothing, use a hook or the bellRun /terminal-setup once

For iTerm2, go to Settings, Profiles, Terminal, check "Notification Center Alerts", then in Filter Alerts enable "Send escape sequence-generated alerts". For any terminal, you can force a bell:

{
  "preferredNotifChannel": "terminal_bell"
}

If you use Option-key shortcuts, enable "Use Option as Meta Key" (Apple Terminal) or set the Option keys to "Esc+" (iTerm2).

Should I use tmux or terminal tabs?

Tabs are enough for two or three agents; tmux helps when you want sessions that survive closing the terminal window. Both work.

With tabs, name each tab after the project or task so you can find the one that is waiting on you. With tmux, add these lines from the Claude Code docs to ~/.tmux.conf so Shift+Enter and notifications work:

set -g allow-passthrough on
set -g focus-events on
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'

Then reload with tmux source-file ~/.tmux.conf and restart Claude Code. Notifications pass through only from a visible pane, so a pane in a window you are not viewing sends none.

How do I run several agents without conflicts?

Give each agent its own git worktree. A worktree is a second checkout of the same repository on a different branch, so two agents never edit the same files.

Claude Code has this built in. The --worktree flag (-w) starts Claude in an isolated worktree at <repo>/.claude/worktrees/<name>, and --tmux creates a tmux session for it, using iTerm2 native panes when available:

claude --worktree fix-login
claude -w add-export --tmux

Worktrees do not include gitignored files such as .env. If a task genuinely needs one, Claude Code reads a .worktreeinclude file at the project root to copy specific gitignored files into new worktrees. Think twice before copying secrets around.

For Codex or plain git, create worktrees yourself:

git worktree add ../myapp-fix-login -b fix-login
git worktree list
git worktree remove ../myapp-fix-login

The guide on running multiple Claude Code sessions covers naming, merging and cleanup.

How do I get notified when an agent needs me?

Turn every "agent is waiting" event into a macOS notification. Without this, a permission prompt can sit in a background tab for an hour.

For Claude Code, add a Notification hook to ~/.claude/settings.json. This example from the hooks guide uses osascript:

{
  "hooks": {
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"'"
          }
        ]
      }
    ]
  }
}

For Codex, enable tui.notifications in ~/.codex/config.toml, which can filter on agent-turn-complete and approval-requested, or point the notify key at a script, per the Codex advanced config docs.

Test it once: trigger a prompt, switch to another app, and make sure something appears. Also check that your terminal has notification permission in System Settings, Notifications. Details are in Claude Code notifications on Mac and Codex notifications.

How do I keep track of usage?

Check usage before long tasks, and know when your window resets. Running out halfway through a task is the most common way to lose an afternoon.

  • In Claude Code, /usage shows plan usage bars for subscribers and a breakdown of what used them, such as subagents or MCP servers. You can also add usage to a custom status line.
  • In Codex CLI, /usage shows account token usage and rate-limit resets, and /status shows the session configuration and token usage.

Usage limits use rolling windows and weekly caps that change over time, so rely on the tools rather than remembered numbers. See Claude Code usage limits, Codex usage limits and the comparison of usage trackers.

How do I keep secrets out of reach?

Keep secrets out of the project folder where you can, and deny the agent access to the ones that must stay. A Mac used for daily development usually has .env files, ~/.ssh, cloud credentials and tokens in the shell environment.

In Claude Code, add deny rules and turn on the sandbox, which uses macOS Seatbelt:

{
  "permissions": {
    "deny": ["Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)"]
  },
  "sandbox": {
    "enabled": true,
    "allowUnsandboxedCommands": false,
    "filesystem": {
      "denyRead": ["~/.ssh", "~/.aws"]
    }
  }
}

The sandbox matters because deny rules only cover Claude's file tools and the shell commands Claude Code can analyze, while the sandbox is enforced by the OS for every shell command. By default, sandboxed commands can read most of the machine, including ~/.ssh, hence the denyRead entries.

In Codex, stay on the default workspace-write sandbox and set shell_environment_policy so variables containing KEY, SECRET or TOKEN are excluded (set ignore_default_excludes = false, since the default does not exclude them).

Claude Code itself stores its own API keys and tokens in the macOS Keychain. The security checklist covers the rest.

How do I stop my Mac from sleeping during long tasks?

Use caffeinate, the built-in macOS command that prevents sleep while it runs. If the Mac sleeps, a running agent stops making progress until you wake it.

From its man page, the useful options are:

  • -i prevents idle sleep of the system.
  • -d prevents the display from sleeping.
  • -s prevents system sleep, but only on AC power.
  • -w <pid> holds the assertion until a given process exits.
  • -t <seconds> drops the assertion after a timeout.

Two practical ways to use it:

# Keep the Mac awake for as long as this Claude Code session runs
caffeinate -i claude

# Keep it awake for 3 hours while agents run in other tabs
caffeinate -i -t 10800

When you pass a command, caffeinate holds the assertion for exactly as long as that command runs, so the Mac can sleep normally afterward. Leaving the display free to sleep (no -d) saves power while the agent keeps working. On a laptop, stay plugged in for long runs.

A daily routine

Put together, a typical day looks like this:

  1. Open your terminal and check usage for Claude Code and Codex.
  2. Start one worktree per task, with a clear, finishable prompt for each.
  3. Start the long runs under caffeinate -i.
  4. Do something else. Answer prompts as notifications arrive.
  5. When a task finishes, review the diff, run the tests and commit or discard.
  6. Remove finished worktrees with git worktree remove.

More on the "do something else" part in letting your coding agents work while you watch, chat or play.

One place for prompts, sessions and usage

The setup above spreads information across terminal tabs, notification banners and slash commands. Allowbar is a macOS menu bar app (macOS 14 or later, with or without a notch) that pulls it together for Claude Code and Codex. Permission requests slide down from the top of the screen with the project, tool and exact command, and you answer Allow, Block, or Terminal. Every session is listed with its state, the ones waiting on you on top, and a click opens its terminal tab. Claude, Codex and Cursor usage sit in one place with the next reset time, with warnings below 50% and 20%.

Allowbar connects through the agents' own hooks, never approves anything on its own, and keeps everything on your Mac. Allowbar is in private beta. Join the waitlist; the launch price is $9.99 instead of $29.90. See also the best Mac apps for Claude Code.

Sources:

Frequently asked questions

What is the best terminal for Claude Code on a Mac?

Ghostty, iTerm2 and Kitty are good choices because Claude Code sends desktop notifications to them by default (iTerm2 needs its alert settings on). They also support Shift+Enter for newlines without setup. Apple Terminal works but needs a bell or hook for notifications.

How do I keep my Mac awake while Claude Code runs?

Start the session with caffeinate -i claude. The Mac stays awake for as long as Claude Code runs, then sleeps normally. To keep it awake for a set time instead, use caffeinate -i -t followed by a number of seconds.

Should I use tmux with Claude Code?

You can. Add allow-passthrough, focus-events and the extended keys lines to ~/.tmux.conf so notifications and Shift+Enter work. Claude Code's --tmux flag, combined with --worktree, creates a tmux session for a new worktree.

How do I run Claude Code and Codex in parallel without conflicts?

Give each agent its own git worktree on its own branch. Claude Code can create one with claude --worktree <name>, and for Codex you can run git worktree add yourself.

How do I stop coding agents from reading my SSH keys?

In Claude Code, enable the sandbox and add ~/.ssh to sandbox.filesystem.denyRead, since sandboxed commands can read most of the machine by default. In Codex, keep the default sandbox on, never use danger-full-access on your main machine, and keep keys out of the environment with shell_environment_policy.

ALLOWBAR FOR MAC

Answer your agents from the menu bar.

Permission requests from Claude Code and Codex slide down from the top of your screen. Allow, Block or send back to the terminal. Allowbar never approves anything on its own.

Launch price $9.99 instead of $29.90, one-time purchase, lifetime license.