Skip to content

Commit 20fc1ae

Browse files
committed
updated docs for 1.1
1 parent 508e2d7 commit 20fc1ae

File tree

3 files changed

+125
-5
lines changed

3 files changed

+125
-5
lines changed

ChangeLog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Change Log – utiluti
2+
3+
## v1.1
4+
5+
(2025-03-30)
6+
7+
- new `app` verb which lists types and url schemes associated with an app
8+
- new `file` verb to inspect and set default apps for specific files
9+
10+
## v1.0
11+
12+
first release

ReadMe.md

Lines changed: 112 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ You can use `utiluti` to inspect and modify default apps for url schemes and fil
88

99
## Important notes:
1010

11-
- `utiluti` should be run as the current user
11+
- `utiluti` should run as the current user
1212

13-
- 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.
13+
- 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. (See [macadmins/default-browser](https://github.com/macadmins/default-browser/tree/main) for an alternative)
1414

15-
- macOS connects the `http` and `https` url schemes and the `public.html` UTI. You can only set the default app for `http` and 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` will result in an error.
15+
- 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.
1616

1717
## URL schemes
1818

@@ -57,7 +57,7 @@ set com.microsoft.Outlook for mailto
5757

5858
## File Type/Uniform Type Identifiers (UTI)
5959

60-
[Uniform type identifiers](https://developer.apple.com/documentation/uniformtypeidentifiers/) (UTI) are how macOS maps file and mime type. `utiluti` uses UTIs.
60+
[Uniform type identifiers](https://developer.apple.com/documentation/uniformtypeidentifiers/) (UTI) are how macOS maps file and mime types. `utiluti` uses UTIs.
6161

6262
To get the UTI associated with a file extension, use `get-uti`:
6363

@@ -96,3 +96,111 @@ $ utiluti type set public.plain-text com.barebones.bbedit
9696
set com.barebones.bbedit for public.plain-text
9797
```
9898

99+
## Getting an App's declarations
100+
101+
`utiluti` can list the UTIs and url schemes an app has declared in their Info.plist:
102+
103+
List the URL schemes for a given app with `app schemes`:
104+
105+
```sh
106+
$ utiluti app schemes com.apple.safari
107+
http
108+
https
109+
file
110+
x-safari-https
111+
```
112+
113+
List the UTIs and file extensions for a given app with `app types`
114+
115+
```sh
116+
$ utiluti app types com.apple.TextEdit
117+
public.rtf
118+
com.apple.rtfd
119+
public.html
120+
com.apple.webarchive
121+
org.oasis-open.opendocument.text
122+
org.openxmlformats.wordprocessingml.document
123+
com.microsoft.word.wordml
124+
com.microsoft.word.doc
125+
public.text
126+
public.plain-text
127+
com.apple.traditional-mac-plain-text
128+
public.data
129+
```
130+
131+
Some 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:
132+
133+
```sh
134+
$ utiluti app types com.apple.safari
135+
file extension: css (public.css)
136+
file extension: pdf (com.adobe.pdf)
137+
file extension: webarchive (com.apple.webarchive)
138+
file extension: webbookmark (com.apple.safari.bookmark)
139+
file extension: webhistory (com.apple.safari.history)
140+
file extension: webloc (com.apple.web-internet-location)
141+
file extension: download (com.apple.safari.download)
142+
file extension: safariextz (com.apple.safari.extension)
143+
file extension: gif (com.compuserve.gif)
144+
file extension: html (public.html)
145+
file extension: htm (public.html)
146+
file extension: shtml (public.html)
147+
file extension: jhtml
148+
file extension: js (com.netscape.javascript-source)
149+
file extension: jpg (public.jpeg)
150+
file extension: jpeg (public.jpeg)
151+
file extension: txt (public.plain-text)
152+
file extension: text (public.plain-text)
153+
file extension: png (public.png)
154+
file extension: tiff (public.tiff)
155+
file extension: tif (public.tiff)
156+
file extension: url (com.microsoft.internet-shortcut)
157+
file extension: ico (com.microsoft.ico)
158+
file extension: xhtml (public.xhtml)
159+
file extension: xht (public.xhtml)
160+
file extension: xhtm (public.xhtml)
161+
file extension: xht (public.xhtml)
162+
file extension: xml (public.xml)
163+
file extension: xbl
164+
file extension: xsl (org.w3.xsl)
165+
file extension: xslt (org.w3.xsl)
166+
file extension: svg (public.svg-image)
167+
file extension: avif (public.avif)
168+
file extension: webp (org.webmproject.webp)
169+
file extension: heic (public.heic)
170+
file extension: jxl (public.jpeg-xl)
171+
```
172+
173+
## Default app for specific files
174+
175+
macOS 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.
176+
177+
Get the UTI for a given file:
178+
179+
```sh
180+
$ utiluti file get-uti ReadMe.md
181+
net.daringfireball.markdown
182+
```
183+
184+
Get the app that will open the file when double-clicked:
185+
186+
```sh
187+
$utiluti file app ReadMe.md
188+
/System/Applications/TextEdit.app
189+
```
190+
191+
List all apps that can open the file:
192+
193+
```sh
194+
$ utiluti file list-apps ReadMe.md
195+
/System/Applications/TextEdit.app
196+
/Applications/Xcode.app
197+
/Applications/Xcode.app/Contents/Applications/Instruments.app
198+
/System/Applications/Notes.app
199+
```
200+
201+
Set the default app for this file:
202+
203+
```sh
204+
$ utiluti file set ReadMe.md com.apple.dt.xcode
205+
set com.apple.dt.xcode for ReadMe.md
206+
```

Sources/utiluti/utiluti.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ struct UtilUTI: AsyncParsableCommand {
99
static let configuration = CommandConfiguration(
1010
commandName: "utiluti",
1111
abstract: "Read and set default URL scheme and file type handlers.",
12-
version: "1.1dev",
12+
version: "1.1",
1313
subcommands: [
1414
URLCommands.self,
1515
TypeCommands.self,

0 commit comments

Comments
 (0)