Skip to content
Edith

Docs

Command reference

Default Apps

Default Apps chooses which app opens each kind of file and link. It lists the common file types (documents, images, video, audio, code and archives) and link types (web, mail, calendar, FaceTime and other schemes) with the app that opens each one, changes one or a whole group, shows what will change first, undoes a change, and exports or imports the setup as a JSON file for another Mac.

The ed command line

It has no command group of its own. Every action is an operation on the running extension through ed invoke, with a JSON payload and a JSON result on stdout. A refused request prints its reason on stderr and exits non-zero, as described in conventions.

Operation Payload What it does
list {"group": "code", "kind": "scheme", "query": "md", "app": "Zed"} Lists file and link types with their default app and every app that can open them. Every key is optional.
set {"extension": "md", "app": "dev.zed.Zed"} Changes the default app for one file extension, content type (type) or link scheme (scheme).
apply {"preset": "code", "app": "Zed", "dryRun": true} Changes a whole preset, group list (groups), extensions or schemes to one app.
presets {} Lists the presets and the suggested apps installed on this Mac.
app {"app": "Preview"} Lists every type in the table an app can open, and the types and schemes it declares.
export {"path": "~/Desktop/default-apps.json"} Returns the setup, and writes it to path when given.
import {"path": "~/Desktop/default-apps.json", "dryRun": true} Applies a setup from path, or from an inline document.
undo {"dryRun": true} Puts back the apps the most recent change replaced.
status {} Reports whether a change can be undone.
Terminal
ed invoke defaultApps list --json '{"group":"images"}'ed invoke defaultApps set --json '{"extension":"md","app":"dev.zed.Zed"}'ed invoke defaultApps set --json '{"scheme":"mailto","app":"Mail"}'ed invoke defaultApps apply --json '{"preset":"code","app":"Zed","dryRun":true}'ed invoke defaultApps apply --json '{"extensions":["png","jpg"],"app":"Preview"}'ed invoke defaultApps export --json '{"path":"~/Desktop/default-apps.json"}'ed invoke defaultApps import --json '{"path":"~/Desktop/default-apps.json","dryRun":true}'ed invoke defaultApps undo

app takes a bundle identifier, an app name or the absolute path of an .app bundle. A name that matches more than one app is refused; use the bundle identifier instead. Unknown keys and values of the wrong type are rejected.

Groups and presets

group is one of documents, images, video, audio, code, archives, web, mail, calendar, facetime or custom. kind is fileType or scheme. The table holds the built-in types, the extensions and schemes added in the tool's settings and, unless that setting is off, every link scheme an installed app declares, under custom.

The presets are code, images, video, audio, text, pdf, archives, web (web pages and http and https links), mail, calendar (webcal links and .ics files) and calls (facetime, facetime-audio, tel and sms). extensions, schemes and groups can be given with or without a preset and are added to it.

list

JSON
{  "apps": [{ "bundleID": "dev.zed.Zed", "name": "Zed", "path": "/Applications/Zed.app" }],  "groups": [{ "count": 1, "group": "code" }],  "rows": [    {      "candidates": [        { "bundleID": "com.apple.TextEdit", "name": "TextEdit", "path": "/System/Applications/TextEdit.app" },        { "bundleID": "dev.zed.Zed", "name": "Zed", "path": "/Applications/Zed.app" }      ],      "defaultApp": { "bundleID": "com.apple.TextEdit", "name": "TextEdit", "path": "/System/Applications/TextEdit.app" },      "extensions": ["swift"],      "group": "code",      "needsConfirmation": false,      "target": { "id": "public.swift-source", "kind": "fileType" },      "title": "Swift source"    }  ]}

apps lists every app that opens or can open a type in the whole table, for a filter menu. A file type's target.id is its content type identifier; types macOS only knows by extension, such as .go, have a dyn. identifier. needsConfirmation is true for http and https.

set, apply, import and undo

These four return the same result. With "dryRun": true nothing changes and outcomes is empty; the plan shows what would change.

JSON
{  "dryRun": false,  "message": "Changed 1 default.",  "outcomes": [    {      "from": { "bundleID": "com.apple.TextEdit", "name": "TextEdit", "path": "/System/Applications/TextEdit.app" },      "now": { "bundleID": "dev.zed.Zed", "name": "Zed", "path": "/Applications/Zed.app" },      "status": "applied",      "target": { "id": "net.daringfireball.markdown", "kind": "fileType" },      "title": "Markdown",      "to": { "bundleID": "dev.zed.Zed", "name": "Zed", "path": "/Applications/Zed.app" }    }  ],  "plan": {    "changeCount": 1,    "changes": [      {        "extensions": ["md"],        "from": { "bundleID": "com.apple.TextEdit", "name": "TextEdit", "path": "/System/Applications/TextEdit.app" },        "group": "documents",        "needsConfirmation": false,        "status": "change",        "target": { "id": "net.daringfireball.markdown", "kind": "fileType" },        "title": "Markdown",        "to": { "bundleID": "dev.zed.Zed", "name": "Zed", "path": "/Applications/Zed.app" },        "toLabel": "Zed"      }    ],    "needsConfirmation": false,    "skippedCount": 0,    "summary": "1 change",    "unchangedCount": 0,    "unresolved": []  },  "undoAvailable": true}
  • A planned change's status is change, unchanged (the app is already the default), unsupported (the app does not say it can open the type; reason explains) or missingApp (an imported app is not installed on this Mac). Only change entries are applied.
  • unresolved lists extensions macOS has no file type for.
  • An outcome's status is applied, declined, failed or skipped. now is the default app after the change.
  • Changing the web browser (http or https) makes macOS show its own confirmation window. The change waits for it, up to two minutes. Choosing to keep the current browser, or leaving the window open, reports declined with the browser that was kept. Both schemes change together, so the second one is reported as applied without asking again.
  • Each applied change is recorded so undo can put the previous apps back; the last 20 changes are kept. status reports interrupted when Edith stopped in the middle of a change, which undo can still reverse. A type that had no default app before cannot be reset to none, so undo leaves it.

export and import

A setup file looks like this:

JSON
{  "assignments": [    {      "app": { "bundleID": "dev.zed.Zed", "name": "Zed", "path": "/Applications/Zed.app" },      "extensions": ["swift"],      "kind": "fileType",      "type": "public.swift-source"    },    {      "app": { "bundleID": "com.apple.mail", "name": "Mail" },      "kind": "scheme",      "type": "mailto"    }  ],  "computerName": "Studio Mac",  "exportedAt": "2027-01-15T08:00:00Z",  "format": "edith.defaultApps",  "version": 1}

export returns document, count, message and the path it wrote. It refuses to replace an existing file unless "overwrite": true. groups limits the export to those groups.

import matches apps by bundle identifier, then by name when the file has no bundle identifier. A dyn. type is resolved again from its extension. The file must have format edith.defaultApps and version 1, at most 4,000 assignments, no type assigned twice, and be at most 1 MiB; a file that breaks a rule is refused with the assignment number and the reason.

app

JSON
{  "app": { "bundleID": "dev.zed.Zed", "name": "Zed", "path": "/Applications/Zed.app" },  "declaredContentTypes": ["public.text", "public.source-code", "public.json"],  "declaredExtensions": ["go", "rs"],  "declaredSchemes": ["zed"],  "opensAnything": false,  "rows": [    {      "currentDefault": { "bundleID": "com.apple.TextEdit", "name": "TextEdit", "path": "/System/Applications/TextEdit.app" },      "extensions": ["swift"],      "group": "code",      "isDefault": false,      "target": { "id": "public.swift-source", "kind": "fileType" },      "title": "Swift source"    }  ],  "version": "1.0"}

The declared lists come from the app's own Info.plist. rows are the types in the table macOS says the app can open, plus any it is already the default for.