Tag Archives: shell

Stay ahead of git with this sharp script

I work on quite a few git repositories at once, and I don’t always commit changes in one before making changes to another. Or if I do, I don’t always push the changes up straight away. That might not be best practice in software development, but hey, it’s what I do. The issue for me is remembering what state each repo is in. Here’s the script I use to tell me.

Continue reading

How To Write macOS Command Line Tools with Swift

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.

imageprep running in Terminal
Continue reading

Give macOS’ Terminal a better ‘ls’

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.

gls in action in macOS’ Terminal app
Continue reading

Using the Z shell on the Mac and Pi

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.

Continue reading