A small macOS app you should never use that holds permission grants on behalf of anything you run through it.
macOS asks your permission before a program can watch the keyboard, control other apps, or record the screen. Every program has to ask separately. macOS remembers each grant against one specific program, and silently drops it when that program is rebuilt or its virtual environment moves. For a developer running scripts and automation tools, this means the same dialogs over and over, a Settings list full of entries called python3.13, and things that stop working for no visible reason.
Imp is a small signed app that holds the grants once, for everything you run through it.
Imp python watch_keys.py
The script now has whatever permissions Imp has. Nothing needed to be signed, bundled, or granted separately, and nothing breaks when you rebuild it or move it.
Double-click Install-Imp.pkg from the latest GitHub Release, or run in Terminal:
curl -fsSL https://raw.githubusercontent.com/AnswerDotAI/imp/main/install.sh | sh
Both download Imp.app.zip from the latest GitHub Release, install Imp.app in ~/Applications, register .impsh scripts with LaunchServices, and link Imp into ~/.local/bin when that directory exists. Apple Silicon only.
Then grant it what you need, once:
Imp --grant accessibility
A permission applies only to processes started after you grant it, so restart whatever you are running once the grant is in place.
To upgrade immediately, run Imp --update (or re-run the installer); every grant survives. To remove Imp, first run Imp --reset all to clear its Privacy & Security entries (the Notifications one is separate, and stays until reset in its own pane). Then delete ~/Applications/Imp.app and the ~/.local/bin/Imp link.
Imp <command> [args...] run a command with Imp's permissions
Imp --grant <a,b> get the named permissions, one at a time
Imp --check <a,b> print "ok", or the missing permissions and exit 1
Imp --reset <a,b|all> return categories to not-determined, so a dialog can come again
Imp --status report every permission's state
Imp --version print the version
Imp --notify <title> [body] post a notification
Imp --alert <title> [body] [button...] show a message box, and exit with the button's index
Imp --web <title> [url|file|-] show a web page in a panel; "-" reads HTML from stdin, Esc closes
Imp --pick <title> [--keys <chars>] <item...> choose by key: one char per item in order, or digits when omitted
Imp --show <title> show stdin in a scrollable monospaced panel
Imp --snap <path|-> capture a still from the default camera; '-' writes it to stdout
Imp --open <path...> preview and run a script in a panel
Imp --update check GitHub Releases and update ~/Applications/Imp.app
Imp --tray run the Imp menu bar plugin host
Imp --add-catalog <owner/repo> subscribe to a GitHub catalog repo
Imp --remove-catalog <owner/repo> remove a subscribed catalog repo
Imp finds the command the way a shell does, so Imp pytest works as well as Imp /path/to/pytest, and an executable script with a shebang runs as Imp ./watch_keys.py. Whatever it runs keeps Imp's permissions, including anything that program starts in turn.
Permission names are accessibility (watching input, controlling other apps, sending synthetic keystrokes), screen (screen recording, and reading window titles), microphone, camera, speech (Apple's speech recognition), contacts, calendars, reminders, photos, and notifications. Imp always asks for the broadest access a category offers: full access for calendars and reminders, read-write for photos.
--grant asks for one permission at a time in a fresh Imp process and confirms it before moving to the next. It asks macOS to show its own dialog, then waits up to two minutes for the permission to really work. macOS shows each dialog only once per category, so if you dismissed it in the past no dialog can appear. After the wait, Imp prints the exact open command for the right Settings pane and what to switch on, then exits nonzero. Imp --reset <name> clears the category back to not-determined, so the dialog can come again. --reset all clears every TCC category, which is also the clean way to remove Imp's Settings entries before uninstalling. Like a grant, a reset only applies to processes started afterwards.
--check prints ok and exits 0 when every named permission is granted. Otherwise it prints every missing name and exits 1, so both humans reading output and scripts reading the exit code get an answer.
--notify, --alert, --web, --pick, and --show exist because macOS will not let an unbundled process speak to the user at all. Notification Center refuses a process with no bundle, and a window needs an application to own it. Since Imp is a bundled application, anything running under it can use these. The windowed ones are Imp's wisps: transient panels that appear, take an answer, and close. A notification takes about 20ms and needs the notifications permission. An alert blocks until its box is dismissed, and exits with the index of the button pressed. So Imp --alert "Delete?" "" Delete Cancel is a usable confirmation in a script. A pick prints the chosen index to stdout and exits 1 when dismissed, so i=$(Imp --pick ...) reads naturally in shell. Esc or the close button dismisses any wisp.
Every wisp has three properties: content (what it renders), geometry, and an end-condition. Geometry is --frame <spec> on --web, --pick, and --show: tr/tl/br/bl pins the panel to that corner of the visible screen, 400x300 sets a size centered, and 400x300@tr does both. The end-condition changes with --live on --show and --web. A live panel stays up while stdin stays open. Each stdin line is one update: --show replaces its text with the line, and --web evaluates the line as JavaScript in the loaded page, whose target defaults to about:blank. For a live panel, EOF exits 0 and the close button exits 2; malformed command lines instead exit 64, so wrappers cannot mistake them for dismissal. A live panel normally never takes key focus, so it cannot interrupt typing and Esc cannot reach it. --web --live --key instead takes the keyboard while leaving the previous application frontmost, for interactive pages. Its stdout is JSON lines: a {"kind":"ready"} event after the page has loaded, followed by {"kind":"message","value":...} for each value the page sends with webkit.messageHandlers.imp.postMessage(value). tail -f log | Imp --show ticker --live --frame br is a corner ticker that never takes keyboard focus.
Imp.app owns the .impsh extension as a plain-text document type. Double-clicking a .impsh file in Finder opens a preview panel showing the file path, the interpreter parsed from its #! line (defaulting to /bin/bash), and the full script text. Click Run to execute the interpreter with the script path as an argument and stream combined stdout and stderr into the panel, or Cancel to close without running. Running the interpreter directly avoids needing execute permissions or clearing macOS quarantine on downloaded scripts. Imp --open <path...> opens the same panel from the command line.
When running from ~/Applications/Imp.app, Imp checks GitHub Releases at most once every 24 hours, caching the timestamp at ~/Library/Caches/com.answerdotai.imp/last-update-check. On Finder .impsh launches, a due check runs synchronously with a 2-second timeout and re-executes the updated binary with --open if a newer release installs. On CLI launches, a due check runs in a detached background process and posts a notification when an update installs so long-running processes can restart. Before replacing ~/Applications/Imp.app, Imp verifies the downloaded bundle with codesign --verify --strict --deep and checks that its designated requirement matches com.answerdotai.imp and team 9T4M7L8547. Auto-update is skipped when ~/Applications/Imp.app is a symlink or IMP_NO_UPDATE=1 is set.
Launching Imp.app from Spotlight or ~/Applications (or running Imp --tray) starts Imp in the menu bar. Open Manage Plugins... to add catalog repositories, sign in to GitHub for private repositories, toggle Launch at Login, and install, enable, disable, update, or uninstall tools. Imp --add-catalog <owner/repo> and Imp --remove-catalog <owner/repo> edit the subscribed catalog list in ~/.config/imp/config.json and refresh a running tray host immediately.
Clicking Sign in to GitHub... runs GitHub App Device Flow (Answer.AI Imp, Contents read-only; override the client ID with IMP_GITHUB_CLIENT_ID), copies the one-time code to the clipboard, opens https://github.com/login/device, stores the access and refresh tokens in macOS Keychain, and rotates single-use refresh tokens automatically.
A catalog repository provides catalog.json ({"name": "...", "repos": ["owner/repo", ...]}), and each listed repository provides imp.json (id, name, description, kind: "plugin" or "installer", asset template with {tag}/{version}, optional sha256 asset name, bin and args or install/uninstall script paths, and optional permissions). Imp verifies SHA-256 checksums, prompts for missing TCC permissions via --grant, runs enabled plugins as child processes with IMP_BIN, IMP_PLUGIN_ID, and IMP_PLUGIN_VERSION set, logs stderr to ~/Library/Logs/Imp/<id>.log, and checks GitHub Releases every 24 hours to restart updated plugins and notify when Imp itself is ready to restart.
Plugins drive their submenu over JSON lines on stdio: write {"title": "...", "items": [{"title", "id", "enabled", "checked", "sep", "items": [...]}]} to stdout, read {"click": "<id>"} from stdin, and invoke $IMP_BIN --web, --alert, or --notify for popups and notifications.
--status reports the state of every permission, and which program macOS thinks it is talking to:
$ Imp --status
running as: Imp
accessibility : true
screen : false
notifications : true
running as should always say Imp. Anything else means Imp failed to make itself the responsible process, and the permissions reported belong to whatever launched Imp instead.
For a background agent, put Imp at the front of a launchd plist's ProgramArguments:
<key>ProgramArguments</key>
<array>
<string>/Users/you/Applications/Imp.app/Contents/MacOS/Imp</string>
<string>/path/to/venv/bin/python</string>
<string>-m</string>
<string>youragent</string>
</array>
macOS decides which program a permission check applies to by walking up the process tree to a responsible process. The binary that made the call is irrelevant. That is why a Python script started from a terminal is treated as the terminal, and why every script you run inherits your terminal's permissions today.
Imp makes itself the responsible process and then runs your command as a child, so your command is treated as Imp. When started from a terminal, Imp would ordinarily inherit the terminal's identity instead. So it re-launches itself once with responsibility disclaimed, which macOS supports for exactly this purpose.
macOS records permissions against a code signature requirement rather than a hash of the binary. Imp's requirement is its bundle identifier plus the Answer.AI team ID, so a new version installed over the old one keeps every permission, with no second entry in Settings and no prompt.
Anything you run through Imp has every permission Imp has been granted. That is the whole point, and it means Imp is exactly as trustworthy as the things you choose to run through it. Grant it only what you need, and don't hand Imp to code you wouldn't hand your keyboard to.
Needs Xcode and, for signing, a Developer ID certificate.
swift build -c release
swift test
The helpers in fastcocoa.swifttool and devtool.py build the package, assemble and sign Imp.app, produce dist/Imp.app.zip with ditto, build and notarize dist/Install-Imp.pkg, and publish GitHub Releases (then bump impVersion) with release_imp(). An unsigned or ad-hoc-signed build works, but its permissions are keyed to the exact binary, so they are lost on every rebuild.
The Imp target is Swift, with pure parsing helpers in ImpCore. Alongside it, CImp is a small C target for the declarations Swift cannot see: two libSystem functions Apple exports without declaring in any header, and the wait(2) status macros. Sources/CImp/include/CImp.apinotes then annotates that header so Swift imports it with the correct optional types and readable names, which is worth reading before adding anything to the shim.
The version is impVersion in Sources/Imp/main.swift, and the build writes it into the bundle's Info.plist.