The other day on Twitter, I got a question about a flag for the
readlink command that I was not familiar with. As it turns out, the
readlink command (which tells you where a symbolic link points to) got an update in macOS 12.3 and now has a
-f option. With this new option,
readlink will resolve symbolic links anywhere in the path and print the ‘actual’ absolute path to the item. This is equivalent to the
realpath command available on Linux and some programming languages.
I have written about this before, and then I mentioned that there is a python function to resolve the path. However, even back then I anticipated the removal of python and suggested using a zsh parameter expansion modifier instead:
The removal of Python 2 is the likely explanation for why Apple chose to update
readlink in 12.3.
It will be nice to have the new
readlink -f option available going forward, but if your script still needs to support versions of macOS older than 12.3 then you should prefer to use the zsh expansion modifier.
More Monterey Command Line Changes?
This was discovered mostly by chance. While Apple’s release notes are improving, there are still nowhere near detailed enough and missing this level of detail, even though that would be amazingly useful.
I remembered that the Kaleidoscope app team had posted a script that allows me to compare man pages between versions of macOS. They published this back when macOS 12 was released to track the changes of the
plutil command line tool. With the help of this tool I determined a few more interested changes in macOS 12, the most interesting of which I will summarize here.
(Even with this script, the process was tedious. Many changes to the man pages are just reformatting whitespace and/or typos. I may have missed something. Please, let me know when you find more changes!)
-woption (splits fields on whitespace)
-Aoption (apparent size)
--sioption (human-readable, in 1000 based units)
-toption (only show items over a certain threshold)
aa (Apple Archive)
- new options for encryption
aeacommand for encrypted Apple Archives
- new encryption and compression types
-sparseprimary (so you can find APFS sparse files)
segmentsubcommand and Segmented images are deprecated
UDBZdmg format (bzip2 compression) is deprecated
udifderezare deprecated (this allows to embed a license in a dmg)
-coptions (probably just the man page updated)
-Doption (date format)
whiteoutfile type (no idea what this is? Update: Greg Parker has some insights and more questions)
-uoption to open file paths as URLs
I have an article on the new
typesubcommand to query type
createsubcommand to create a new empty plist
-poption prints working directory with symbolic links resolved
-foption to resolve symbolic links
-Ioption which prompts only when more than three files will be deleted or a directory is being removed recursively
- new command to run, list, or interact with Shortcuts
nano command now actually opens
pico. (Thanks, @rgov) Most people won’t notice this, as the two are quite similar. The excision of GNU tools from macOS continues.