Skip to content
Agentmart
Submit a tool

macos-root

Run commands as root on this Mac via osascript "do shell script ...

Skill by MaxAnderson95

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/maxanderson95-macos-root

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Run commands as root on this Mac via osascript "do shell script ... with administrator privileges", because sudo cannot prompt for a password in opencode. Use whenever a task needs root/sudo/admin privileges, sudo fails with "a password is required", or the task touches root-owned config, LaunchDaemons, /usr/local, or other privileged paths.

Use cases: productivity, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/macos-root

What's inside

Skill name
macos-root
Description
Run commands as root on this Mac via osascript "do shell script ... with administrator privileges", because sudo cannot prompt for a password in opencode. Use whenever a task needs root/sudo/admin privileges, sudo fails with "a password is required", or the task touches root-owned config, LaunchDaemons, /usr/local, or other privileged paths.
License
MIT
Instructions
20 lines in SKILL.md · view on GitHub

Files (2)

  • SKILL.md
  • fleet.yaml

SKILL.md (first lines)

# Privilege Escalation on macOS (sudo vs osascript)

In this opencode environment, `sudo` cannot prompt for a password — there's no controlling TTY and no askpass helper, so any plain `sudo ...` call fails with `sudo: a password is required`. Don't keep retrying sudo or pretend it'll work eventually.

When you need root on this Mac, use `osascript` with administrator privileges instead. It pops a native macOS authorization dialog (or Touch ID, if `pam_tid` is enabled for SecurityAgent) and runs the command as root via Authorization Services.

```bash
osascript -e 'do shell script "your-command-here" with administrator privileges'
```

## Rules and gotchas

- The shell inside `do shell script ... with administrator privileges` already runs as **root**. Do NOT add `sudo` inside it — it's redundant.
- Without `with administrator privileges`, the shell runs as the user, and `sudo` inside will fail for the same TTY reason as before. Always include the clause.
- Each `osascript` invocation triggers its own auth prompt. To minimize prompts, **batch the work**: write a single shell script to the pre-approved opencode temp directory (the `/var/folders/.../T/opencode` path named in your system prompt), `chmod +x` it, and run the whole script through one `osascript` call.
- This requires Max to be physically at the Mac to approve the dialog. It is not suitable for unattended automation — if you'd be blocked on the prompt, say so and stop instead of waiting indefinitely.
- For non-trivial root operations (editing root-owned config, restarting LaunchDaemons, installing into `/usr/local/`, etc.), prefer staging the changes into the opencode temp directory first, then have the elevated script copy/install them. Easier to review the diff before approving the prompt.
- When a fallback path exists (write a file under the opencode temp directory and give Max the `sudo` commands to run himself), that's also valid — use it when the change is one-shot and trivial, or when Max has said he'd run the commands.

From MaxAnderson95/my-opencode-setup, MIT.

More from MaxAnderson95/my-opencode-setup

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 2, 2026 (28 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from MaxAnderson95

Cite this page

macos-root skill. Agent Mart. https://agentmart.dev/skills/maxanderson95-macos-root (last updated 2026-10-24)