How do you safely interrupt a command-line program written in Swift? This question was posed to me this week by a reader who got in touch to point out that boilerplate code included in my How to write macOS command line tools in Swift post might not be totally safe: it could leave a program and system in an undefined state, which is never a good thing. So I took a closer look.Continue reading
Let the great Homebrew migration begin. Yes, Homebrew now has native support for Apple’s ARM64-based M1 chip. The latest version, 3.0.0, released 5 February, will run nicely on your Apple Silicon Mac. There’s a catch, of course. Well, several catches: first, not all of the tools you can install using Homebrew are M1 native yet and, second, Homebrew doesn’t offer explicit migration instructions, that I could find at least.Continue reading
I’ve spent a lot of time of late working on several macOS command line tools written in Swift. So I’ve gathered together the key points I’ve learned while creating and updating pdfmaker and imageprep: some best practices and ways to deliver many of the features common to programs the run at the command line.Continue reading
The Nano command line text editor has reached a new milestone: version 5.0.
There are the usual array of bug fixes and tweaks, but what caught my eye among the release notes was the introduction of a scroll indicator. This tells you where you are within a long file and is particularly good for mouse users so you can see where you’ve got to as you mouse-wheel through a document.Continue reading
A few posts back, I talked about the script I use to package macOS apps that I distribute outside of the Mac App Store. That script is designed to simplify the complex process of signing and notarizing not only the app itself but also the installer package its ships within. This is all made necessary by the ever more rigorous, annoying but necessary security provisions Apple is applying to macOS.Continue reading
I use the Nano text editor for command line work. The version installed by Apple (2.0.6) is well behind the curve; use Brew to supersede it with the latest version (5.x at the time of editing).Continue reading
Anyone who uses Terminal will run the ls command to get a listing of files and directories. It’s built in to macOS’ BSD Unix foundation layer. It has one key limitation for me: it has no option to list directories before listing files. Read on to learn how to deal with this issue.Continue reading
When Apple released MacOS Catalina, it decided to switch the default command line shell from the Bourne Again Shell, aka bash, to the Z Shell, aka zsh. One reason for this was that Apple installs a rather old version of bash, 3.3.57, to allow it to include the software under a licence it’s happy with. This isn’t a problem that affects zsh, so Apple can bundle a much more recent release.
That was no problem for me, either, because I long ago used Homebrew to install an up-to-date version of bash, 5.0.17, and have been happily using in preference to the Apple one. To do so yourself, run
brew install bash and then go to System Preferences > Users & Groups. Unlock if you need to then right-click on your name in the left-hand column and select Advanced Options…. Now highlight the Login shell: field and set the path to your preferred shell, in this case
/usr/local/bin/bash. Afterwards, you can enter
echo $SHELL to confirm the change.