claude-code-notifier
how it works guides faq
◐English
English العربية Deutsch Español Français עברית Italiano 日本語 한국어 Nederlands Polski Português (Brasil) Русский Türkçe Tiếng Việt 简体中文 繁體中文
Get started
All guides

What is osascript on a Mac, and why does Claude Code run it?

Updated 27 November 2026 · 4 min read
on this page 01What osascript does 02Why it appears with Claude Code 03The "wants access to control" prompt 04Other macOS prompts while Claude Code works 05Is osascript a virus? 06A quieter alternative to osascript hooks 07FAQ

osascript is a command line tool built into macOS that runs AppleScript and JavaScript for Automation scripts. It lives at /usr/bin/osascript, is made by Apple, and is safe in itself. With Claude Code you usually see it for one of two reasons: a notification hook uses osascript -e 'display notification ...' to show a macOS banner, or Claude ran an AppleScript to control another app because a task needed it. When a script controls another app, macOS asks whether your terminal may control it, and you can allow or refuse.

01What osascript does

AppleScript is Apple's language for telling Mac apps what to do. osascript runs it from the terminal, from a file or from lines passed with -e:

osascript -e 'display notification "Build finished" with title "Claude Code"'
osascript -e 'tell application "Safari" to activate'
osascript -e 'set volume output muted true'

The first line shows a notification, the second brings Safari to the front, the third mutes the sound. Anything an AppleScript can do, osascript can do from a script.

02Why it appears with Claude Code

  • Notification hooks. Anthropic's hooks guide uses osascript -e 'display notification ...' as its macOS example for being told when Claude needs you. If you set that up, every notification runs osascript for a moment, and you may see it in Activity Monitor. See Claude Code notifications on macOS.
  • Claude running it as a command. If you ask Claude to do something in another app, such as open a page, read a calendar or change a setting, it may write an AppleScript and run it with osascript. In the default permission mode that shows up as a Bash prompt you can approve or refuse.
  • Other tools. Some notification tools and editor plugins call osascript too.

03The "wants access to control" prompt

The first time a script run from your terminal controls another app, macOS shows a privacy prompt along the lines of "Terminal" wants access to control "System Events". The app named first is your terminal (Terminal, iTerm2, Ghostty, VS Code), because Claude Code runs inside it. The second is the app being controlled.

  • Allow if you expected Claude or your hook to control that app.
  • Don't Allow if you did not. The script fails and nothing else changes.

You can review these later in System Settings > Privacy & Security > Automation, where each terminal lists the apps it may control. To clear every answer and be asked again:

tccutil reset AppleEvents

A plain display notification does not need this permission. It runs through Script Editor, so notifications must be allowed for Script Editor in System Settings > Notifications, or the command finishes without showing anything.

04Other macOS prompts while Claude Code works

Prompts such as Terminal would like to access files in your Documents folder, or access to Photos or Music, appear when a command Claude runs, such as a search across your home folder, touches a folder macOS protects. They name your terminal for the same reason. Allow them only if the task needs those folders; refusing just makes that command skip them. Your choices are in System Settings > Privacy & Security > Files and Folders.

05Is osascript a virus?

No. It is part of macOS. What matters is the script it runs. If you see osascript and did not set up a hook or ask Claude to automate an app, check your Claude Code hooks with /hooks and look at recent commands in your session.

06A quieter alternative to osascript hooks

An osascript hook only shows a banner on the Mac itself, and only while you are at it. Claude Code Notifier is an independent tool (not made by Anthropic) that replaces it with pushes to your phone: a free command line tool, ccn, for Mac, Windows and Linux, and apps for iPhone and Android, with one-tap answers to permission requests and questions.

07FAQ

What is osascript on Mac?

A built-in macOS command that runs AppleScript and JavaScript for Automation scripts from the terminal. It lives at /usr/bin/osascript and comes with macOS.

Why does Claude Code use osascript?

Usually for a notification hook that shows a macOS banner, or because Claude ran an AppleScript to control another app for a task you gave it.

Why does my terminal want to control System Events?

A script run in that terminal, often by Claude Code or a hook, tried to control another app. macOS asks you first; allow it only if you expected it.

How do I reset the osascript Automation permissions?

Run tccutil reset AppleEvents in Terminal, or change each entry in System Settings > Privacy & Security > Automation.

Claude Code Notifier Get a push on your phone when Claude Code finishes or needs you, then approve, deny or answer from there. The ccn command line tool is free on Mac, Windows and Linux.
Download for iOS Download for Android Install ccn

Use OpenAI's Codex CLI? Notifier for Codex does the same for Codex.

Use Antigravity? Try Antigravity Notifier

Related guides

  • Claude Code notifications on macOSGet a macOS notification when Claude Code finishes or needs permission: built-in terminal alerts, an osascript hook, terminal-notifier, or ccn.
  • The Claude Code Notification hook: when it fires and how to use itWhen Claude Code's Notification hook fires, what permission_prompt and idle_prompt mean, the input it gets, and why it waits before firing.
  • What is Claude Code URL Handler on my Mac?Claude Code URL Handler is a small app Claude Code installs so claude-cli:// links can open a session. What it does, whether it is safe, and how to turn it off.
  • Claude Code notifications not working? A checklistHooks not firing or no alert when Claude Code finishes? Work through this checklist, from /hooks and the debug log to ccn doctor and ccn test.
claude-code-notifier

Claude Code Notifier is an independent third-party application. It is not affiliated with, endorsed by, or sponsored by Anthropic, PBC. "Claude" and "Claude Code" are trademarks of Anthropic, PBC.

apps iOS App Android App ccn for macOS, Windows & Linux All guides Use Codex? Try Notifier for Codex Use Antigravity? Try Antigravity Notifier
legal Privacy Policy Terms of Service Other languages © 2026 touchtap. All rights reserved. TouchTap Ltd is registered in England and Wales, company number 13942589.