afconvert(1) - an audio file format converter, which includes Apple's superior AAC codec from the Core Audio framework
diskutil(8) - tons of tools for fixed and removable storage
Oh wow! A while back I ripped some concert audio from Youtube, but it was too large for me to sync using my `iTunes Match`. I've been too lazy to figure out how to downsample it juuuuust enough. But it looks like this works right out of the box
> (Uses built-in macOS capabilities for transcription from audio to text.)
Question (to self, currently researching)... Which capabilities? Released when? I ask because Apple Intelligence has expanded the use of audio transcription features.
Answer: `hear` uses SFSpeechRecognizer [1] which has been available since macOS 10.15. I'm not yet sure how it relates to Apple Intelligence transcription services.
Note: "speech recognition is a network-based service" which perhaps suggests Apple Intelligence (the marketing term, not an Apple Developer term, I don't think) uses it as well
open -n file.pdf : opens new instance of Preview application which is useful if you want to open the same file twice (for example to look at different pages at once).
caffeinate -d : prevents display turning off, useful if you want to look at display without moving mouse.
Finder is pretty good, and it's handy to be able to open it from the terminal. But I find it super annoying it litters everything with .DS_Store files and there is no way to turn that off, except for external and network drives. Aside from, obviously, using a different file manager. Very un-Apple.
If you have a modern Mac you have very little business using `pdisk`. It is only for editing disks mapped with an “Apple Partion Map”. This is obsolete replaced in practice by GPT on modern apple machines.
If you want the least useful macOS commandline utility, 'pdisk' is:
"...a menu driven program which partitions disks using the standard
Apple disk partitioning scheme described in "Inside Macintosh: Devices".
It does not support the Intel/DOS partitioning scheme[.]"
What I'm really missing still is a cli to iCloud stored passwords. AFAIK 'security' cli can't access the credentials stored in the cloud. This would be helpful to store secrets outside of git but would still allow scriptable access to them similarly as 1password cli 'op' has.
Sort of like command+k in the Finder, connects to a server. You can type in vnc://host or vnc://localhost:port... the latter is for VNC to hosts via an SSH tunnel.
As they seem to have removed Bluetooth Explorer and all ways to get diagnostic info about the bluetooth system and/or change codecs and settings, does anybody know any good cmdline ways in later mac osxes to do the same?
For example I'm having a problem that comes and goes now and then where Bluetooth audio is 300 ms delayed compared to the video playback everywhere except in Youtube on Safari, very strange. It's good for a few months then suddenly it becomes unusable, then back to zero sync delay after a few months.
I was thinking this might be related to CODEC selections etc or some hidden setting that might get changed which we normally aren't allowed to determine :)
(btw I know there is a difference between latency and synchronization - latency might be unavoidable but video sync should always be able to compensate - I got curious on how exactly that works, where in the app / SDK / OS pipeline does the a/v sync happen on a Mac?)
Thanks.. but that github program only lists the same info you get if you command-click on the BT icon in the menu bar. It basically only shows the device name.
I guess filtering the streaming log entries in the Console app gives some info.
I've found reliably "turning on" with pmset to be hit or miss. I can't remember the gotcha I ran into if it was that you had to have your laptop lid open or something else...
It actually understands roman numerals, to a certain extent. E.g. `say LVIII` will say "58". However, `say MCMLXXIX` speaks some gibberish that ends in the word "six", for some reason.
It also knows how to say numbers up into the trillions but not more than that (although I feel like it used to).
At my job I have to work with a lot of JSON that's usually minimized. This command has single-handedly saved my sanity:
$ pbpaste | jq | pbcopy
Then I can paste it into whatever text editor I want and it's all nice & pretty-printed for me.
Bonus is that I don't have to change the command at all, just copy the minimized JSON to the clipboard (say from DBeaver, for example), then hit the 'up' arrow and enter.
since I switch between linux and macos a lot I wrote a dotfile function called "clip" that will work the same on both. nice thing is it will automatically paste if nothing is piped to it to copy so there's no need to use separate commands... although I just realized it might be nice to have a "passthrough" mode that both copies and pastes if you add this to a pipeline in order to capture some intermediate part to the clipboard
if [[ "$(uname)" == "Darwin" ]]; then
clip() {
[ -t 0 ] && pbpaste || pbcopy
}
else # assume linux if not macos
clip() {
[ -t 0 ] && xclip -o -selection clipboard || xclip -selection clipboard
}
fi
That's handy, thanks! `osc copy` may also take args for files to copy to the clipboard, but in the absence of that and no data on stdin it maybe should switch to paste.
Does anyone remember the shortcut that brings up a list of currently available keyboard shortcuts for the current app? It may not be built-in, in which case it was a free utility.
I have thousands of old photos that preview can open, but I can’t upload them into the photo.app because the file format is wrong. I’m going to try and use SIPS to convert them all into png first and then add to photo.app. Thanks for this pointer.
sips looks really cool, thanks for pointing this out.
Not gonna lie, I missed this because I thought it was related to macOS SIP, System Integrity Protection. Which is something I am deeply uninterested in.
I'm fascinated by "sips" which has a full JavaScript interpreter built into it for rendering images using an entirely undocumented (as far as I can tell) Canvas-like API: https://til.simonwillison.net/macos/sips
locate searches a database for all pathnames which match the specified pattern.
The database is recomputed periodically, (about once a week) and contains the path-names of all files which are publicly accessible.
Looks like a lot of these have linux equivalents that could be aliased. I wonder if anyone's made a set of those for regular macos users who occasionally use something else.
Say you've got a directory that has scripts or data files related to some thing you do. For example I've got several scripts that I use when I scan books with my book scanner. I only need these when doing book scanning stuff so don't want to put them somewhere in $PATH. I want to be able to easily run them from scripts that aren't in that directory, but I don't want to hard code the path to that directory.
Solution: in the directory with the book scanning scripts I make a file named ID that contains a unique string. I currently use 16 byte random hex strings [1].
I have this script, named find-dir-by-ID, somewhere in $PATH:
#!/bin/zsh
ID=${1:?Must specific ID}
IDSHA=`echo $ID | shasum | cut -d ' ' -f 1`
mdfind $ID 2>/dev/null | grep /ID | while read F; do
FSHA=`shasum $F | cut -d ' ' -f 1`
if [ $IDSHA = $FSHA ]; then
dirname $F
exit 0
fi
done
exit 1
If some script wants to use scripts from my book scanning script directory, it can do this:
SCRIPT_DIR=`find-dir-by-ID 54f757919a5ede5961291bec27b15827`
if [ ! -d $SCRIPT_DIR ]; then
>&2 echo Cannot find book scanning scripts
exit 1
fi
and then SCRIPT_DIR has the full path to the scanning script directory.
The IDs do not have to be hex strings. If I'd thought about it more I probably would have made IDs look like this "book-scanning:54f757919a5ede59" or "arduino-tools:3b6b4f47bf803663".
[1] here's a script for that:
#!/bin/sh
N=${1:-8} # number of bytes
xxd -g $N -c $N -p -l $N < /dev/urandom
You mean something like having ~/well-known-stuff and under that having a 54f757919a5ede5961291bec27b15827 directory with the book scanning scripts and so on?
That could work fine, but generally the directories I've used this on are directories that I want to have somewhere else, and with a reasonable name. Usually the directories came first and various other things in fixed relative positions were using them, and then later I wanted to use them from elsewhere and added the ID.
I suppose ~/well-known/stuff/54f757919a5ede5961291bec27b15827 could by a symbolic link to the original.
The mdfind approach does have the advantage that if I reorganize things and move the directory it keeps working.
I set a shell alias so I can just do `airport -s`. I've no idea why this is hidden away inside some framework and not in a directory which is in the normal path, but there you go.
FWIW that appears to be soon deprecated according to MacOS 15.2:
WARNING: The airport command line tool is deprecated and will be removed in a future release.
For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool.
Oh, that's a pity. I'm pretty bad at keeping up to date on MacOS releases, but I should probably start figuring out `wdutil` so that my muscle memory is adapted before I've got no choice!
plutil. Maybe not that useful to a lot of people but I have been going through and collecting bookmarks and Safari bookmarks are binary files. plutil is a means of converting the binary property file to a json or xml file.
That's interesting, I have never needed to do that. My Pixels have always just charged even if the lid is closed, on Intel and Apple Silicon machines. I like to travel light so I often use my laptop as a battery bank instead of carrying a seperate one.
Indeed, many applications I would expect to prevent sleeping (some audio playback ones, games, etc.) don't implement this. I assume it's a case of Apple's APIs changing over the years and not everyone catching up/caring. At one point I had downloaded Amphetamine[^1] but it is much nicer to just use the terminal here.
While it may avoid sleep, it doesn’t prevent inactivity, in my experience. For instance, my chat app at work will still show me inactive while running caffeinate. I have to do non-interactive training semi-regularly and need to interact to keep from looking like I’m away from my desk.
Doesn’t work with Slack at least. I’ve had an iTerm window running `caffeinate -disu` for years. I think it used to work and stopped working in the last few months.
I was able to install a `caffeine` package with Apt on Linux. In that one the `caffeinate` command is supposed to be run with another command. While the `caffeine` command does what macOs `caffeinate` does.
This can be done by passing a PID. I believe there are other options, as well. (Not at my computer to look it up right now.) I haven't used those features "manually", but I have in scripts that I expect to generate long-running processes.
> If you store your secrets in the Keychain (and you should!)
As part of the OS, Keychain suffers from the same sorts of sharp edges as using a built-in interpreter. An alternative is to use a password manager. Below is an example of the tools available in one.
Would you mind expanding on what these "sharp edges" are that you're warning about? I'm not really sure what you mean by this. Keychain has served me (and I imagine many others) really well for a while.
A couple more:
Examples:> afconvert
Oh wow! A while back I ripped some concert audio from Youtube, but it was too large for me to sync using my `iTunes Match`. I've been too lazy to figure out how to downsample it juuuuust enough. But it looks like this works right out of the box
How does that compare with ffmpeg? The arguments seem about the same.
I would like to also recommend the app:
See: https://sveinbjorn.org/hear(Uses built-in macOS capabilities for transcription from audio to text.)
Its open source GitHub repo at https://github.com/sveinbjornt/hear
Man page at https://sveinbjorn.org/files/manpages/hear.1.html
> (Uses built-in macOS capabilities for transcription from audio to text.)
Question (to self, currently researching)... Which capabilities? Released when? I ask because Apple Intelligence has expanded the use of audio transcription features.
Answer: `hear` uses SFSpeechRecognizer [1] which has been available since macOS 10.15. I'm not yet sure how it relates to Apple Intelligence transcription services.
Note: "speech recognition is a network-based service" which perhaps suggests Apple Intelligence (the marketing term, not an Apple Developer term, I don't think) uses it as well
[1][ https://developer.apple.com/documentation/speech/sfspeechrec...
I thought I recognized the name of the developer! The person that brought us Platypus! Nice.
> which hear
> hear not found
macOS 15.1
Few additions.
open -n file.pdf : opens new instance of Preview application which is useful if you want to open the same file twice (for example to look at different pages at once).
caffeinate -d : prevents display turning off, useful if you want to look at display without moving mouse.
I use this all the time:
open -a <GUI Application> <File>
Handy for distinguishing between editing and consuming media.
open -a "Finder" . - open Finder in the current directory.
Standard apps usually just need the name, like Finder and Safari but you can also specify the path "/Applications/DifferentFinder.app"
You can also `open -R file` to select that file in Finder.
`open .` works for me too
Yeah, I scrolled a bit and noticed that. Never thought about using just that.
Finder is pretty good, and it's handy to be able to open it from the terminal. But I find it super annoying it litters everything with .DS_Store files and there is no way to turn that off, except for external and network drives. Aside from, obviously, using a different file manager. Very un-Apple.
you can just
unless you've reconfigured something else to open directories, which most people haven't.open -a is nice, i use it with alias, ex:
At least for me (I've installed vlc via homebrew), there is a vlc binary in the PATH, and I can just vlc <filename>
The point here is to open a document with an app not assigned as default for the given mime-type by file name extension.
Also, `cd .` to open the current directory in a Finder window.
Not mine (found online years ago), but here's the opposite. `cd` into the frontmost Finder window:
You mean `open .`
You can also just drag the proxy icon onto the terminal window for its path, ie “cd “ <drop>, enter.
I use that all the time. You can also cmd-c copy a file in Finder then paste into the terminal to get its path.
Does `open` give focus? It used to, but since a few releases ago the app opens in the background, which is pretty annoying.
My poor workaround is to use osascript: `tell application "System Events" to set frontmost of process "Finder" to true`
Apparently, it does. There is a -g flag (background) to prevent focus.
`caffeinate -disu` is the best combination (that is, enable all options): your laptop won't go to sleep, won't dim the screem etc.
The terminal version of Disk Utility is actually much better than the GUI (it doesn't hang and the app is glitchy.
Docs are at https://ss64.com/mac/diskutil.html
`pdisk` might be more convenient if you've worked with `gdisk` on ArchLinux
https://manpagez.com/man/8/pdisk/
If you have a modern Mac you have very little business using `pdisk`. It is only for editing disks mapped with an “Apple Partion Map”. This is obsolete replaced in practice by GPT on modern apple machines.
`gdisk` supports GPT, but to partition system SSD you need to deactivate System Integrity Protection:
diskutil does more than edit partitions, though.
Or "man diskutil"
One-liner for previewing a file with Quick Look. I aliased this to `ql` :)
I'm curious if there's a way to do this with standard input instead of having to supply a filename?
I do this with man pages but it opens up in a full Preview window, not QuickLook.
This article contains links to https://ss64.com/ , which is an amazing resource that I wish I'd known about sooner!
100% That's why I made it a point to share that page.
I still get a ton of mileage from reading the macOS How-to page https://ss64.com/mac/syntax.html
TinkerTool provides a GUI that runs some useful commands under the hood
https://www.bresink.com/osx/0TinkerTool/download.php
Related - https://news.ycombinator.com/item?id=36491704 "macOS command-line tools you might not know about"
If you want the least useful macOS commandline utility, 'pdisk' is:
It's probably been written about a lot of places already.
For me, increasing the number of icons in the launcher grid was very useful.
After running these three commands, the size of the Launcher will be set to 13x8 apps:
In general, a lot of parameters of different applications can be changed via command `defaults`https://macos-defaults.com/
To get a complete list of parameters, you can execute
What I'm really missing still is a cli to iCloud stored passwords. AFAIK 'security' cli can't access the credentials stored in the cloud. This would be helpful to store secrets outside of git but would still allow scriptable access to them similarly as 1password cli 'op' has.
Not a command, but a little known feature of the Terminal app:
(shift+command+K) or Menu 'Shell' -> 'New Remote Connection...'
opens a SSH, S(FTP), TELNET connection manager window!
Sort of like command+k in the Finder, connects to a server. You can type in vnc://host or vnc://localhost:port... the latter is for VNC to hosts via an SSH tunnel.
It's quite a good VNC client, too.
And sometimes handy: shift+cmd+. to toggle showing hidden (dot) files in Finder.
As they seem to have removed Bluetooth Explorer and all ways to get diagnostic info about the bluetooth system and/or change codecs and settings, does anybody know any good cmdline ways in later mac osxes to do the same?
For example I'm having a problem that comes and goes now and then where Bluetooth audio is 300 ms delayed compared to the video playback everywhere except in Youtube on Safari, very strange. It's good for a few months then suddenly it becomes unusable, then back to zero sync delay after a few months.
I was thinking this might be related to CODEC selections etc or some hidden setting that might get changed which we normally aren't allowed to determine :)
(btw I know there is a difference between latency and synchronization - latency might be unavoidable but video sync should always be able to compensate - I got curious on how exactly that works, where in the app / SDK / OS pipeline does the a/v sync happen on a Mac?)
See: https://chatgpt.com/share/672b94e1-4c20-8001-aea9-9371b4e9d9...
Also: https://github.com/toy/blueutil
Thanks.. but that github program only lists the same info you get if you command-click on the BT icon in the menu bar. It basically only shows the device name.
I guess filtering the streaming log entries in the Console app gives some info.
To find what causes your laptop drains its battery, you can use
I knew it! coreaudiod is using very high CPU at 111.90 ms/s
I'm on a 16" M1 Macbook Pro 16 gig. Thanks Spotify.
$ say Hello
To scare your teammates when you are logged in remotely optionally with
$ osascript -e "set volume output volume 100"
I'll add `plutil` to the list. It's great for reading plist files, but did you know it can parse json too?
/usr/bin/plutil -extract your.key.path raw -o - - <<< "$jsoninput"
(obviously, less useful now that `jq`is built in)
Starting in macOS 15, it was quietly included.
Glad to spread the good word ;)
> obviously, less useful now that `jq`is built in
Hold up, what?
There is also pmset which is very useful (since macOS doesn't give a UI counterpart) https://support.apple.com/en-am/guide/mac-help/mchl40376151/...
Oh this is pretty neat, thanks for sharing!
https://ss64.com/mac/pmset.html
I have this .zshrc function to track the battery and charging, which uses pmset:
I've found reliably "turning on" with pmset to be hit or miss. I can't remember the gotcha I ran into if it was that you had to have your laptop lid open or something else...
"I like to look at the list of macOS Bash commands."
Sigh. These are shell commands, not "Bash commands".
These are programs, not shell commands.
If you're going to correct someone snarkily, don't make a similar mistake...
Even calling them "zsh commands" would have been more accurate.
A fun easter egg in the "say" command is that "OS X" is said as "Oh Ess Ten".
You can also change voices with -v. My favorite is "cellos" since it sings to you.
It actually understands roman numerals, to a certain extent. E.g. `say LVIII` will say "58". However, `say MCMLXXIX` speaks some gibberish that ends in the word "six", for some reason.
It also knows how to say numbers up into the trillions but not more than that (although I feel like it used to).
Not sure that's an easter egg? That's been the pronunciation for 25 years.
It's at least manually programmed in. Otherwise it would have said 'Ecks'
It misses the most important of them all, if you are used to copy content to usb drive for reading on a multimedia player : dot_clean -m
pbcopy and pbpaste are handy, for a version that works over ssh connections there is osc: https://github.com/theimpostor/osc
At my job I have to work with a lot of JSON that's usually minimized. This command has single-handedly saved my sanity:
$ pbpaste | jq | pbcopy
Then I can paste it into whatever text editor I want and it's all nice & pretty-printed for me.
Bonus is that I don't have to change the command at all, just copy the minimized JSON to the clipboard (say from DBeaver, for example), then hit the 'up' arrow and enter.
since I switch between linux and macos a lot I wrote a dotfile function called "clip" that will work the same on both. nice thing is it will automatically paste if nothing is piped to it to copy so there's no need to use separate commands... although I just realized it might be nice to have a "passthrough" mode that both copies and pastes if you add this to a pipeline in order to capture some intermediate part to the clipboard
I went the route of managing a different set of dotfiles for linux and macOS. Same repository, just different branches.
Also, falling back to using oh-my-zsh functionality.
That's handy, thanks! `osc copy` may also take args for files to copy to the clipboard, but in the absence of that and no data on stdin it maybe should switch to paste.
I copied this functionality to linux it's been so useful.
I've never heard of networkQuality, that's seems like quite a useful tool.
For reference, it’s been there since macOS 12. You may also like to know that this year (macOS 15) they added jq.
I didn't know that, thanks!
Unfortunately, it's not actually very useful, as whatever server they're using on the other end is severely constrained. networkQuality gives me:
Downlink: 884.856 Mbps, 198 RPM - Uplink: 13.238 Mbps, 198 RPM
whereas speedtest (whether to the official speedtest server OR a friend's home server in their basement!) gives ~700 Mbps uplink.
try
That's a more apples to apples comparison to speedtest.net; Separate upload and download tests.My non-built-in CLI utility recommendations, none of which are macOS specific:
* atuin - TUI for shell history, backed by SQLite - https://github.com/atuinsh/atuin
* LSD (LSDeluxe) - rewrite of `ls` - https://github.com/lsd-rs/lsd
* ripgrep - https://github.com/BurntSushi/ripgrep
* fzf - command-line fuzzy finder that enhances file search, command history search, and more - https://github.com/junegunn/fzf
Notes:
- To get pretty extra file/folder symbols with LSD, you'll probably need to install some special fonts.
- You can use `fzf` and `ripgrep` together.
I can vouch for fzf being a game-changer if you spend a lot of time in the CLI
My problem with fzf is that it's so broadly useful that I forget it exists.
Does anyone remember the shortcut that brings up a list of currently available keyboard shortcuts for the current app? It may not be built-in, in which case it was a free utility.
Cheatsheet? I've used it for years. Just hold down Command for a few seconds to see a list of all available shortcut keys in the current app.
https://www.mediaatelier.com/CheatSheet/feedNotes.php
https://formulae.brew.sh/cask/cheatsheet
sips https://ss64.com/mac/sips.html
I have thousands of old photos that preview can open, but I can’t upload them into the photo.app because the file format is wrong. I’m going to try and use SIPS to convert them all into png first and then add to photo.app. Thanks for this pointer.
Similarly, I've had trouble getting audio files into a format that the Books app understands (for ebooks), until I found
Nice. After reading the man page, I see that it can be used to convert image file formats:
or resizing:sips looks really cool, thanks for pointing this out.
Not gonna lie, I missed this because I thought it was related to macOS SIP, System Integrity Protection. Which is something I am deeply uninterested in.
I maintain a more comprehensive list here: https://notes.billmill.org/computer_usage/mac_os/mac_os_comm...
But I don’t have uuidgen!
I'm fascinated by "sips" which has a full JavaScript interpreter built into it for rendering images using an entirely undocumented (as far as I can tell) Canvas-like API: https://til.simonwillison.net/macos/sips
Since Apple spent so much effort in getting certified:
https://www.opengroup.org/openbrand/register/
These are all guaranteed to work:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/
(I may not have linked to the precisely correct version.)
locate searches a database for all pathnames which match the specified pattern. The database is recomputed periodically, (about once a week) and contains the path-names of all files which are publicly accessible.
The database is not set up by default.
Your better bet on MacOS is to use `mdfind -name ....`
I have that aliased to `locate` on mine. It's not exactly the same but it gets me 99% of the way there.
Looks like a lot of these have linux equivalents that could be aliased. I wonder if anyone's made a set of those for regular macos users who occasionally use something else.
Here's a handy use I've found for mdfind.
Say you've got a directory that has scripts or data files related to some thing you do. For example I've got several scripts that I use when I scan books with my book scanner. I only need these when doing book scanning stuff so don't want to put them somewhere in $PATH. I want to be able to easily run them from scripts that aren't in that directory, but I don't want to hard code the path to that directory.
Solution: in the directory with the book scanning scripts I make a file named ID that contains a unique string. I currently use 16 byte random hex strings [1].
I have this script, named find-dir-by-ID, somewhere in $PATH:
If some script wants to use scripts from my book scanning script directory, it can do this: and then SCRIPT_DIR has the full path to the scanning script directory.The IDs do not have to be hex strings. If I'd thought about it more I probably would have made IDs look like this "book-scanning:54f757919a5ede59" or "arduino-tools:3b6b4f47bf803663".
[1] here's a script for that:
Why not just a directory with subdirectories by ID? No mdfind needed, no problems with just-created directories, no wait, etc
You mean something like having ~/well-known-stuff and under that having a 54f757919a5ede5961291bec27b15827 directory with the book scanning scripts and so on?
That could work fine, but generally the directories I've used this on are directories that I want to have somewhere else, and with a reasonable name. Usually the directories came first and various other things in fixed relative positions were using them, and then later I wanted to use them from elsewhere and added the ID.
I suppose ~/well-known/stuff/54f757919a5ede5961291bec27b15827 could by a symbolic link to the original.
The mdfind approach does have the advantage that if I reorganize things and move the directory it keeps working.
Want to scan the local wifi networks from the command line, and get useful information like signal strength?
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s
I set a shell alias so I can just do `airport -s`. I've no idea why this is hidden away inside some framework and not in a directory which is in the normal path, but there you go.
FWIW that appears to be soon deprecated according to MacOS 15.2:
WARNING: The airport command line tool is deprecated and will be removed in a future release. For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool.
Oh, that's a pity. I'm pretty bad at keeping up to date on MacOS releases, but I should probably start figuring out `wdutil` so that my muscle memory is adapted before I've got no choice!
I got this trick from someone on the Internet:
$> long_running_command && say "Witness me, for I am done"
plutil. Maybe not that useful to a lot of people but I have been going through and collecting bookmarks and Safari bookmarks are binary files. plutil is a means of converting the binary property file to a json or xml file.
https://keith.github.io/xcode-man-pages/plutil.1.html
Great tip about the `security` command, a new one for me.
cliclick[1] is useful for gap-filling the AppleScript accessibility APIs when automating poorly-behaved applications.
[1] https://github.com/BlueM/cliclick
fs_usage is my favourite - find out what's thrashing the disk. (Usually Spotlight or Spark...)
TIL: caffeinate
Very useful.
For a GUI version, Amphetamine is quite nice (and free). https://apps.apple.com/us/app/amphetamine/id937984704?mt=12
yes amphetamine I use regularly when I want to charge my android phone during travel with lid closed.
That's interesting, I have never needed to do that. My Pixels have always just charged even if the lid is closed, on Intel and Apple Silicon machines. I like to travel light so I often use my laptop as a battery bank instead of carrying a seperate one.
Indeed, many applications I would expect to prevent sleeping (some audio playback ones, games, etc.) don't implement this. I assume it's a case of Apple's APIs changing over the years and not everyone catching up/caring. At one point I had downloaded Amphetamine[^1] but it is much nicer to just use the terminal here.
[^1]: https://apps.apple.com/us/app/amphetamine/id937984704
The "newest" and still supported low level API is almost 14 years old: https://developer.apple.com/documentation/iokit/kiopmasserti... https://developer.apple.com/documentation/iokit/kiopmasserti...
Also https://github.com/newmarcel/KeepingYouAwake
While it may avoid sleep, it doesn’t prevent inactivity, in my experience. For instance, my chat app at work will still show me inactive while running caffeinate. I have to do non-interactive training semi-regularly and need to interact to keep from looking like I’m away from my desk.
Have you used the `-u` flag? From the manual:
Doesn’t work with Slack at least. I’ve had an iTerm window running `caffeinate -disu` for years. I think it used to work and stopped working in the last few months.
I was able to install a `caffeine` package with Apt on Linux. In that one the `caffeinate` command is supposed to be run with another command. While the `caffeine` command does what macOs `caffeinate` does.
It would be cool to have this activate when a Jupyter notebook is currently running a cell, and deactivate automatically when its finished.
This can be done by passing a PID. I believe there are other options, as well. (Not at my computer to look it up right now.) I haven't used those features "manually", but I have in scripts that I expect to generate long-running processes.
mdls shows a file's metadata.
I use it most often for pulling lat lon data from photos.
afconvert is pretty nifty for audio format conversion.
is it better than ffmpeg in any way?
Apple's AAC encoders are often touted as being the 'best', quality-wise: https://hydrogenaud.io/index.php/topic,119876.0.html
As jammmety said; for AAC encoding yes, but don't worry - you can have ffmpeg use that encoder to get the best of both.
afconvert is the only way I've managed to turn mp3s into something that Books would accept as an audiobook.
> If you store your secrets in the Keychain (and you should!)
As part of the OS, Keychain suffers from the same sorts of sharp edges as using a built-in interpreter. An alternative is to use a password manager. Below is an example of the tools available in one.
https://developer.1password.com/docs/cli/get-started/#step-1...
Would you mind expanding on what these "sharp edges" are that you're warning about? I'm not really sure what you mean by this. Keychain has served me (and I imagine many others) really well for a while.
upgrade_mac.sh: https://github.com/westurner/dotfiles/blob/develop/scripts/u... :