Schedule Claude Code to Run Automatically Every Morning on Mac
Run Claude Code or Codex on a schedule on your Mac: a free launchd job, or Sledbot routines with "weekdays at 9", GitHub triggers, approvals and draft PRs.
GuideUpdated 9 min read
On this page
You want Claude Code or Codex to start by itself every weekday morning, without you opening a terminal. Maybe you also want it to react to a new GitHub issue or a push to main. This guide covers both a built-in macOS route and a Sledbot routine, and says plainly what each one can't do.
Why Claude Code doesn't schedule itself
Claude Code and Codex CLI are interactive tools. Each has a non-interactive mode, but neither one is a scheduler for your Mac, so something else has to start them. That raises three problems:
- Time. Something must start the run at 9:00 and survive a closed terminal.
- Permissions. An unattended run has nobody to answer a prompt. It stalls, or you pre-allow everything, which is risky.
- Spend. Nothing in a plain script caps what a run uses.
The sections below handle each of these.
Method 1: a launchd job (free, built in)
launchd is the macOS scheduler. A user agent runs at the times you list, as you, and only while you are logged in.
- Write a script, for example
~/bin/morning-agent.sh, that changes into your project folder and runs your agent's non-interactive command. Check the agent's own docs for the exact flags rather than copying them from a blog post. - Make it executable and test it by hand first:
chmod +x ~/bin/morning-agent.sh. - Create
~/Library/LaunchAgents/com.example.morning-agent.plist. Use full paths (replaceyouwith your user name): launchd does not expand$HOMEor~in these values.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.example.morning-agent</string>
<key>ProgramArguments</key>
<array>
<string>/bin/zsh</string>
<string>-lc</string>
<string>/Users/you/bin/morning-agent.sh</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict><key>Weekday</key><integer>1</integer><key>Hour</key><integer>9</integer><key>Minute</key><integer>0</integer></dict>
<dict><key>Weekday</key><integer>2</integer><key>Hour</key><integer>9</integer><key>Minute</key><integer>0</integer></dict>
<dict><key>Weekday</key><integer>3</integer><key>Hour</key><integer>9</integer><key>Minute</key><integer>0</integer></dict>
<dict><key>Weekday</key><integer>4</integer><key>Hour</key><integer>9</integer><key>Minute</key><integer>0</integer></dict>
<dict><key>Weekday</key><integer>5</integer><key>Hour</key><integer>9</integer><key>Minute</key><integer>0</integer></dict>
</array>
<key>StandardOutPath</key>
<string>/Users/you/Library/Logs/morning-agent.log</string>
<key>StandardErrorPath</key>
<string>/Users/you/Library/Logs/morning-agent.log</string>
</dict>
</plist>- Load it for your user session:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.example.morning-agent.plistTo remove it, run launchctl bootout gui/$(id -u)/com.example.morning-agent and delete the plist file.
If the Mac is asleep at 9:00, launchd runs the missed calendar job when the Mac wakes. cron does not. To wake the Mac shortly before the job, schedule a wake with pmset:
sudo pmset repeat wakeorpoweron MTWRF 08:55:00This sets a repeating weekday wake at 8:55. Undo it with sudo pmset repeat cancel.
What launchd can't do
- No approvals. The run stalls or you pre-allow everything. The second option is the risk covered in a safer alternative to --dangerously-skip-permissions.
- No budget. Nothing caps what a run spends.
- No triggers. It can't start when a GitHub issue is labelled or when someone pushes to main.
- No visibility. You get a log file. Nothing tells you a run is waiting on you.
- Minimal environment. launchd jobs don't read your shell profile. The
-lclogin shell helps, but tools installed through nvm or asdf may still not be found.
Method 2: a Sledbot routine
In Sledbot, a routine is a teammate, an instruction and a trigger. Sledbot runs Claude Code or Codex CLI through their own logins, so the routine uses the CLI you already have. We make Sledbot, so weigh this section accordingly; the limits are spelled out below.
Before you start
- Sledbot is part of MacSuite and needs macOS 14 Sonoma or later. The trial is 7 days; after it, starting agents needs a license. See Sledbot and pricing.
- The agent CLI must be installed and logged in on the machine that will run it. Check Settings > Agents, where each row has Install… or Log in….
- Add your project as a space: File > Add Project Folder… (⌘O).
Set it up
- Create a teammate. In the sidebar under Team, click + (Add teammate). Or use Suggest a team…, which proposes a lead, reviewer, tester and docs teammate from your README, AGENTS.md and CI config without calling a model.
- Set Name, Role and Agent. The default agent is
claude; choose Codex CLI for Codex. - Under Permissions, leave Running commands on Ask every time (the default). Click Create.
- Open the teammate's Routines tab and click New routine.
- Fill in Name, Teammate and Instruction. Brief it like a colleague: "Check yesterday's failed CI runs on main. If the cause is small, fix it and open a draft PR. If not, write up what you found."
- Under When, choose On a schedule and type
weekdays at 9in Schedule. Sledbot shows a live description and Next: … so you can confirm it read you correctly. - Under Where, pick the Machine and Space.
- Under Results, pick the Output and set If a run is missed.
- Turn on Enabled and save.
- Test without waiting for 9:00: in the routine's row menu choose Run now… and confirm. It does real work, so start with a small instruction.
Schedule phrases that work
The parser is rule-based and works offline. Always check the Next: … line.
| You type | Meaning |
|---|---|
weekdays at 9 | Monday to Friday at 9:00 |
weekdays at 6 pm | Weekdays at 18:00 |
mondays and thursdays at 9:30am | Two days a week |
every 2 hours between 9 and 17 | Every two hours inside a window |
daily, weekly, monthly | Every day; Mondays; the 1st |
0 9 * * 1-5 | A raw 5-field cron line also works |
A day with no time runs at 09:00. Routines must be at least 5 minutes apart ("Routines can run at most every 5 minutes.").
Triggers beyond a clock
Under When you can also pick:
- GitHub event with a Repository (owner/name) and an Event: Issue labelled (plus a Label), PR opened, PR updated, Review requested or CI failed. Sledbot checks with
gh apion the machine every few minutes, so no public URL is needed. - Push to a branch with a Branch, such as
main. Checked every 60 seconds. - Files change with a pattern such as
docs/**/*.md. - After another routine, or Only when I run it.
There is no plain "issue opened" event, so for "a new GitHub issue" the closest fit is Issue labelled. The first check of a GitHub, push or file trigger only sets a baseline, so it won't fire for things that already exist. The Webhook option appears in the editor but cannot be enabled from the app or the command line.
Choose what the run produces
Output offers Open a draft PR (the default), Comment on the issue or PR, Commit to a branch, Report only and Notify me. Pushing to main always needs your approval, whatever you pick.
Budgets and approvals for a scheduled run
| Control | Where | What it does for a CLI agent |
|---|---|---|
| Running commands | Teammate > Permissions | Ask every time (default), Always allow or Never allow |
| Unsupervised actions per day | Teammate > Permissions | Default 40. After the cap, everything waits for your approval |
| Built-in ask rules | Always on | Asks before pushes to protected branches, merges, deploys, publishing, sudo, cloud CLI changes, and writes or deletes outside the worktree |
| Approvals expire after N min | Routine > Results | 5 to 1440 minutes, default 30. Expiry marks the run "waiting for you" |
| Daily budget (USD) | Teammate | Not a limit for CLI agents. Per-run cap for native-agent runs only |
Delegated jobs have a separate Caps section for turns, minutes and dollars (empty means no cap), but that is a different feature; see jobs and Night shift.
Approvals differ by agent. Claude Code can be blocked before it acts. Codex and other CLIs are detect-and-answer: Sledbot mirrors the agent's own permission prompt as a card and answers it by typing keys, but it can't stop an action the agent runs without asking. For a scheduled Codex routine, keep Ask every time on and keep the agent's own approval prompts on.
Requests appear under Needs you and as banners on the Mac. Phone push can't be set up from the app, so an overnight approval waits for you at the Mac.
If you add several accounts to a teammate, Sledbot can hand work to the next one when one hits its limit. That is opt-in, and some providers restrict using several personal subscriptions this way, so read their terms first.
Does it run if the Mac is asleep?
A sleeping Mac can't run anything, so decide where the routine lives.
- This Mac: it must be awake at 9:00. The default If a run is missed is Skip it; switch to Run once when back if a late run beats none. To keep the Mac awake, see keep your Mac awake while Claude Code or Codex runs.
- A server you own: pick it as the Machine. Sledbot's engine keeps running there while your Mac sleeps. See run agents on your own servers.
Remote caveats: the shipping app doesn't bundle the Linux binaries, so adding a Linux machine without ~/.sledbot/bin/sled already there fails during setup. Another Mac works. Keys saved on your Mac are not copied to remotes, and the agent CLI must be installed and logged in on the remote itself.
Pick a method
| launchd job | Sledbot routine | |
|---|---|---|
| Cost | Free | Part of MacSuite ($349 one-time as of November 2026), 7-day trial |
| Schedule | Calendar times in a plist | Plain phrases, cron accepted |
| GitHub, push, file triggers | No | Yes (webhook not available) |
| Approval before risky actions | No | Yes, strongest with Claude Code |
| Dollar cap | No | No for CLI agents |
| Output as draft PR or comment | You script it | Built-in choices |
| Missed run while asleep | Runs on wake | Skip it or Run once when back |
| Remote server | You manage it | Pick a machine |
Pick launchd for one simple job when you're comfortable with a script. Pick a routine for event triggers, an approval step, or runs on a server.
Checklist before you rely on it
- The agent CLI is installed and logged in on the machine that runs it.
- Next: … shows the time you expect.
- Run now… produced a sensible result.
- Running commands is on Ask every time.
- The Mac will be awake, or the routine is on a server.
- For GitHub triggers,
ghis installed and signed in on that machine.
If a scheduled run doesn't happen
- Nothing at 9:00. The Mac was probably asleep and the routine is on Skip it.
- Schedule rejected. Routines must be at least 5 minutes apart. Try
every 15 minutes. - A GitHub or push routine never fired. Only new events count after the baseline check.
- "Waiting for you". An approval expired. Open Needs you or raise Approvals expire after N min.
- "Queued: 3 routines are already running on this machine." Only 3 routine runs go at once per machine. Stagger the times.
- The run looks stuck. Sledbot flags an agent with no output for 10 minutes and no CPU use. Use Send a nudge or Restart with resume.
- The agent isn't found. On a remote, use Agent setup > Install… and Log in…. On this Mac, Load ~/.zshrc when starting agents (on by default) helps with nvm and asdf paths.
- A start is refused. The trial may have ended.
If it still fails, contact support with this:
Sledbot routine did not run. Routine name: <name>. Expected time: <time>.
Machine: This Mac / <machine name>. Output setting: <value>.
"If a run is missed" is set to <value>. The Mac was awake: yes/no.
Error text or status shown in Recent runs: <text>.Common questions
Can I schedule Codex the same way?
Yes. Set the teammate's Agent to Codex CLI. Approvals are detect-and-answer for Codex, so keep its own prompts on.
Do routines cost extra on top of my Claude or Codex plan?
Routines add no per-run fee we know of; the agent uses its own login, so usage counts against that plan or key.
Can I run it every few minutes?
Only at least 5 minutes apart, with at most 3 routine runs at once per machine.
What about an overnight checklist?
That is Night shift, a separate feature. It runs only on an API key with a confirmed spend limit or a local model, never a Claude subscription, and needs Sledbot open and the Mac plugged in.
For more detail, see teammates, memory and routines and needs you and approvals. Sledbot is part of MacSuite; you can try it free for 7 days.