{"id":28591166,"url":"https://github.com/scriptingosx/utiluti","last_synced_at":"2025-10-19T04:36:01.538Z","repository":{"id":281857253,"uuid":"564801043","full_name":"scriptingosx/utiluti","owner":"scriptingosx","description":"A macOS command-line to work with default apps","archived":false,"fork":false,"pushed_at":"2025-03-21T15:08:29.000Z","size":26,"stargazers_count":26,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-21T16:24:10.326Z","etag":null,"topics":["command-line-tool","default","defaultapps","macadmins","macos","terminal"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scriptingosx.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-11T14:28:21.000Z","updated_at":"2025-03-21T15:08:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"8394a057-4815-47d6-8797-8d07e8629fff","html_url":"https://github.com/scriptingosx/utiluti","commit_stats":null,"previous_names":["scriptingosx/utiluti"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptingosx%2Futiluti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptingosx%2Futiluti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptingosx%2Futiluti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptingosx%2Futiluti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scriptingosx","download_url":"https://codeload.github.com/scriptingosx/utiluti/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptingosx%2Futiluti/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259236397,"owners_count":22826309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line-tool","default","defaultapps","macadmins","macos","terminal"],"created_at":"2025-06-11T09:13:38.967Z","updated_at":"2025-10-19T04:36:01.532Z","avatar_url":"https://github.com/scriptingosx.png","language":"Swift","readme":"# utiluti\n\nmacOS command line utility to work with default apps.\n\n## What it does\n\nYou can use `utiluti` to inspect and modify default apps for url schemes and file types/uniform type identifiers (UTI).\n\n## Important notes:\n\n- `utiluti` should run as the current user\n\n- when you attempt to set the default app for the `http` url scheme, macOS will prompt the user for confirmation. The user has the option to reject the change. The user must make a selection for the tool to continue. Consider this when using `utiluti` for automation. You should wrap the script in some other UI to prepare the user for the dialog.\n  (See [macadmins/default-browser](https://github.com/macadmins/default-browser/tree/main) for an alternative solution)\n\n- macOS connects the `http` and `https` url schemes and the `public.html` UTI. You can only set the default app for `http`. Then the default app for `https` and the `public.html` type will be set to the same app. Attempting to change the default apps for `https` or `public.html` independently will result in an error.\n\n- many commands require the bundle identifier to specify an app. You can determine an app's bundle identifier with `utiluti` itself, `mdls`, `osascript`/AppleScript, or a GUI tool like [Apparency](https://www.mothersruin.com/software/Apparency/)\n\n```\n$ utiluti app id /Applications/Safari.app\ncom.apple.Safari\n```\n\n```\n$ mdls -n kMDItemCFBundleIdentifier /Applications/Safari.app\nkMDItemCFBundleIdentifier = \"com.apple.Safari\"\n```\n\n```\n$ osascript -e 'id of app \"Safari\"'\ncom.apple.Safari\n```\n\n## URL schemes\n\nURL schemes are the part of the URL before the colon `:` which identify which app or protocol to use. E.g. `http`, `mailto`, `ssh`, etc.\n\nGet the current default app for a given url scheme:\n\n```\n$ utiluti url mailto          \n/System/Applications/Mail.app\n```\n\nUse the `--bundle-id` flag to receive the app's bundle identifier instead:\n\n```\n$ utiluti url mailto --bundle-id     \ncom.apple.mail\n```\n\nList all apps registered for a given url scheme:\n\n```\n$ utiluti url list mailto          \n/System/Applications/Mail.app\n/Applications/Microsoft Outlook.app\n```\n\nUse the `--bundle-id` flag to receive the apps' bundle identifiers instead:\n\n```\n$ utiluti url list mailto --bundle-id \ncom.apple.mail\ncom.microsoft.Outlook\n```\n\nSet the default app for a given URL scheme:\n\n```\n$ utiluti url set mailto com.microsoft.Outlook\nset com.microsoft.Outlook for mailto\n```\n\n## File Type/Uniform Type Identifiers (UTI)\n\n[Uniform type identifiers](https://developer.apple.com/documentation/uniformtypeidentifiers/) (UTI) are how macOS maps file and mime types. `utiluti` uses UTIs. \n\nTo get the UTI associated with a file extension, use `get-uti`:\n\n```\n$ utiluti get-uti txt            \npublic.plain-text\n```\n\nGet the default application for a UTI:\n\n```\n$ utiluti type public.plain-text\n/System/Applications/TextEdit.app\n```\n\nList all applications registered for the given UTI:\n\n```\n$ utiluti type list public.plain-text\n/System/Applications/TextEdit.app\n/Applications/Numbers.app\n/Applications/Pages.app\n/System/Applications/Utilities/Script Editor.app\n/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app\n/Applications/Xcode.app/Contents/Applications/Instruments.app\n/Applications/Xcode.app\n/System/Applications/Notes.app\n```\n\nAdd the `--bundle-id` flag to receive bundle identifiers instead of paths.\n\nSet the the default app for a given UTI:\n\n```\n$ utiluti type set public.plain-text com.barebones.bbedit\nset com.barebones.bbedit for public.plain-text\n```\n\n## Getting an App's declarations and other information\n\n`utiluti` can list the UTIs and url schemes an app has declared in their Info.plist:\n\nList the URL schemes for a given app with `app schemes`:\n\n```\n$ utiluti app schemes com.apple.safari\nhttp\nhttps\nfile\nx-safari-https\n```\n\nList the UTIs and file extensions for a given app with `app types`\n\n```\n$ utiluti app types com.apple.TextEdit\npublic.rtf\ncom.apple.rtfd\npublic.html\ncom.apple.webarchive\norg.oasis-open.opendocument.text\norg.openxmlformats.wordprocessingml.document\ncom.microsoft.word.wordml\ncom.microsoft.word.doc\npublic.text\npublic.plain-text\ncom.apple.traditional-mac-plain-text\npublic.data\n```\n\nSome apps declare file extensions instead of UTIs. In this case `utiluti` will prepend `file extension:`. If there is an associated UTI, it will be shown in parenthesis:\n\n```\n$ utiluti app types com.apple.safari\nfile extension: css (public.css)\nfile extension: pdf (com.adobe.pdf)\nfile extension: webarchive (com.apple.webarchive)\nfile extension: webbookmark (com.apple.safari.bookmark)\nfile extension: webhistory (com.apple.safari.history)\nfile extension: webloc (com.apple.web-internet-location)\nfile extension: download (com.apple.safari.download)\nfile extension: safariextz (com.apple.safari.extension)\nfile extension: gif (com.compuserve.gif)\nfile extension: html (public.html)\nfile extension: htm (public.html)\nfile extension: shtml (public.html)\nfile extension: jhtml\nfile extension: js (com.netscape.javascript-source)\nfile extension: jpg (public.jpeg)\nfile extension: jpeg (public.jpeg)\nfile extension: txt (public.plain-text)\nfile extension: text (public.plain-text)\nfile extension: png (public.png)\nfile extension: tiff (public.tiff)\nfile extension: tif (public.tiff)\nfile extension: url (com.microsoft.internet-shortcut)\nfile extension: ico (com.microsoft.ico)\nfile extension: xhtml (public.xhtml)\nfile extension: xht (public.xhtml)\nfile extension: xhtm (public.xhtml)\nfile extension: xht (public.xhtml)\nfile extension: xml (public.xml)\nfile extension: xbl\nfile extension: xsl (org.w3.xsl)\nfile extension: xslt (org.w3.xsl)\nfile extension: svg (public.svg-image)\nfile extension: avif (public.avif)\nfile extension: webp (org.webmproject.webp)\nfile extension: heic (public.heic)\nfile extension: jxl (public.jpeg-xl)\n```\n\nShow an app's bundle identifier:\n\n```\n$ utiluti app id /Applications/Safari.app\ncom.apple.Safari\n```\n\nShow an app's version:\n\n```\n$ utiluti app id /Applications/Safari.app\n18.5\n```\n\nList paths to applications for a given bundle identifier: (note that the output might have multiple lines, when there are multiple copies of the app, or be empty when there are no apps matching the identifier)\n\n```\n$ utiluti app for-id com.apple.notes\n/System/Applications/Notes.app\n```\n\n\n\n\n\n## Default app for specific files\n\nmacOS allows for a file to be assigned to an app different from the general default app for that file type. `utiluti` has the `file` verb to inspect or set the default app for a specific file.\n\nGet the UTI for a given file:\n\n```\n$ utiluti file get-uti ReadMe.md\nnet.daringfireball.markdown\n```\n\nGet the app that will open the file when double-clicked:\n\n```\n$utiluti file app ReadMe.md\n/System/Applications/TextEdit.app\n```\n\nList all apps that can open the file:\n\n```\n$ utiluti file list-apps ReadMe.md\n/System/Applications/TextEdit.app\n/Applications/Xcode.app\n/Applications/Xcode.app/Contents/Applications/Instruments.app\n/System/Applications/Notes.app\n```\n\nSet the default app for this file:\n\n```\n$ utiluti file set ReadMe.md com.apple.dt.xcode\nset com.apple.dt.xcode for ReadMe.md\n```\n\n## Setting multiple defaults\n\nThe `manage` verb reads multiple default app assignments from files or from user defaults/configuration profiles.\n\n### Reading from files\n\nThe file format is an XML Property list. You will need two separate files for assigning URL schemes (`--url-file`) and one for assigning file types/UTIs (`--type-file`).\n\nThe root object of the property list is a `dict`, each key will be the url scheme or UTI, respectively. The value is the application bundle identifier for the default app that should be set.\n\n```\n$ utiluti manage --type-file types.plist\nset com.fatcatsoftware.pledpro for com.apple.property-list\nset com.barebones.BBEdit for public.plain-text\nset com.barebones.BBEdit for public.shell-script\n```\n\n```\n$ utiluti manage --url-file urls.plist\nset com.microsoft.Outlook for mailto\nset com.ranchero.NetNewsWire-Evergreen for feed\n```\n\n```\n$ utiluti manage --type-file types.plist --url-file urls.plist\nset com.fatcatsoftware.pledpro for com.apple.property-list\nset com.barebones.BBEdit for public.plain-text\nset com.barebones.BBEdit for public.shell-script\nset com.microsoft.Outlook for mailto\nset com.ranchero.NetNewsWire-Evergreen for feed\n```\n\nYou can have either the `--type-file` or the `--url-file` or both. When only file is given, `utiluti` will _not_ read additional settings from defaults.\n\n**Note:** You can add a default app for the `http` url scheme this way, but it will show the user confirmation dialog when the default browser changes. See [the notes above](#important-notes).\n\nExample (URL Schemes):\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n\t\u003ckey\u003efeed\u003c/key\u003e\n\t\u003cstring\u003ecom.ranchero.NetNewsWire-Evergreen\u003c/string\u003e\n\t\u003ckey\u003emailto\u003c/key\u003e\n\t\u003cstring\u003ecom.microsoft.Outlook\u003c/string\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n```\n\nExample (UTIs):\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n\t\u003ckey\u003ecom.apple.property-list\u003c/key\u003e\n\t\u003cstring\u003ecom.fatcatsoftware.pledpro\u003c/string\u003e\n\t\u003ckey\u003epublic.plain-text\u003c/key\u003e\n\t\u003cstring\u003ecom.barebones.BBEdit\u003c/string\u003e\n\t\u003ckey\u003epublic.shell-script\u003c/key\u003e\n\t\u003cstring\u003ecom.barebones.BBEdit\u003c/string\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n```\n\n### From defaults and managed preferences\n\nFor managed deployments, the settings can be read from a configuration profile.\n\n```\n$ utiluti manage\nset com.fatcatsoftware.pledpro for com.apple.property-list\nset com.barebones.BBEdit for public.plain-text\nset com.barebones.BBEdit for public.shell-script\nset com.microsoft.Outlook for mailto\nset com.ranchero.NetNewsWire-Evergreen for feed\n```\n\nExample (configuration profile):\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n\t\u003ckey\u003ePayloadContent\u003c/key\u003e\n\t\u003carray\u003e\n\t\t\u003cdict\u003e\n\t\t\t\u003ckey\u003ePayloadDisplayName\u003c/key\u003e\n\t\t\t\u003cstring\u003eUtiluti URL Schemes\u003c/string\u003e\n\t\t\t\u003ckey\u003ePayloadIdentifier\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.scriptingosx.utiluti.url\u003c/string\u003e\n\t\t\t\u003ckey\u003ePayloadType\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.scriptingosx.utiluti.url\u003c/string\u003e\n\t\t\t\u003ckey\u003ePayloadUUID\u003c/key\u003e\n\t\t\t\u003cstring\u003eC6BE539F-85CC-424B-BD10-6160A9B87507\u003c/string\u003e\n\t\t\t\u003ckey\u003ePayloadVersion\u003c/key\u003e\n\t\t\t\u003cinteger\u003e1\u003c/integer\u003e\n\t\t\t\u003ckey\u003efeed\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.ranchero.NetNewsWire-Evergreen\u003c/string\u003e\n\t\t\t\u003ckey\u003emailto\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.microsoft.Outlook\u003c/string\u003e\n\t\t\u003c/dict\u003e\n\t\t\u003cdict\u003e\n\t\t\t\u003ckey\u003ePayloadDisplayName\u003c/key\u003e\n\t\t\t\u003cstring\u003eUtiluti UTIs\u003c/string\u003e\n\t\t\t\u003ckey\u003ePayloadIdentifier\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.scriptingosx.utiluti.type\u003c/string\u003e\n\t\t\t\u003ckey\u003ePayloadType\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.scriptingosx.utiluti.type\u003c/string\u003e\n\t\t\t\u003ckey\u003ePayloadUUID\u003c/key\u003e\n\t\t\t\u003cstring\u003e21078E7C-9C38-45F8-92C1-DFF7FBD77405\u003c/string\u003e\n\t\t\t\u003ckey\u003ePayloadVersion\u003c/key\u003e\n\t\t\t\u003cinteger\u003e1\u003c/integer\u003e\n\t\t\t\u003ckey\u003ecom.apple.property-list\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.fatcatsoftware.pledpro\u003c/string\u003e\n\t\t\t\u003ckey\u003epublic.plain-text\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.barebones.BBEdit\u003c/string\u003e\n\t\t\t\u003ckey\u003epublic.shell-script\u003c/key\u003e\n\t\t\t\u003cstring\u003ecom.barebones.BBEdit\u003c/string\u003e\n\t\t\u003c/dict\u003e\n\t\u003c/array\u003e\n\t\u003ckey\u003ePayloadDisplayName\u003c/key\u003e\n\t\u003cstring\u003eUtiluti\u003c/string\u003e\n\t\u003ckey\u003ePayloadIdentifier\u003c/key\u003e\n\t\u003cstring\u003ecom.scriptingosx.utiluti\u003c/string\u003e\n\t\u003ckey\u003ePayloadScope\u003c/key\u003e\n\t\u003cstring\u003eSystem\u003c/string\u003e\n\t\u003ckey\u003ePayloadType\u003c/key\u003e\n\t\u003cstring\u003eConfiguration\u003c/string\u003e\n\t\u003ckey\u003ePayloadUUID\u003c/key\u003e\n\t\u003cstring\u003eE0A43215-6114-413B-BB0B-1478AB79181B\u003c/string\u003e\n\t\u003ckey\u003ePayloadVersion\u003c/key\u003e\n\t\u003cinteger\u003e1\u003c/integer\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n```\n\nBy default, `utiluti manage` will _ignore_ unmanaged defaults, i.e. defaults that come from local settings rather than configuration profiles. You can override this behavior with the `--include-unmanaged` option.\n\n```\n$ defaults write com.scriptingosx.utiluti.type net.daringfireball.markdown com.barebones.BBEdit\n$ defaults read com.scriptingosx.utiluti.type\n{\n    \"net.daringfireball.markdown\" = \"com.barebones.BBEdit\";\n}\n$ utiluti manage --include-unmanaged\nset com.fatcatsoftware.pledpro for com.apple.property-list\nset com.barebones.BBEdit for net.daringfireball.markdown\nset com.barebones.BBEdit for public.shell-script\nset com.barebones.BBEdit for public.plain-text\nset com.ranchero.NetNewsWire-Evergreen for feed\nset com.microsoft.Outlook for mailto\n```\n","funding_links":[],"categories":["Swift"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptingosx%2Futiluti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscriptingosx%2Futiluti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptingosx%2Futiluti/lists"}