If you ever use the command line in Terminal, you’ll have heard no doubt that macOS Catalina has changed the default interactive shell from
bash 3.2 to
zsh 5.7.1. If, like me, you’re unsure of the consequences, you’ll need to read Armin Briegel’s excellent book Moving to zsh, now available in Apple’s Books store.
You may already know Briegel’s writing from his blog Scripting OS X, where he has already generously posted an earlier presentation on this subject which was so well received at MacSysAdmin 2019. This book is far superior, in that he systematically takes this from an explanation of what a shell is, how to configure and customise the shell in Terminal, and key features of zsh.
Even the zsh expert will find this account worth its modest cost. Briegel details supported completions, creation of a dynamic prompt, and a range of useful extensions such as syntax highlighting.
For the casual user, there may seem little that zsh brings which you’re likely to encounter. This is more noticeable when you come to shell scripts, which he covers in detail. I hadn’t realised, for instance, that zsh array indexing starts at 1 rather than 0 – something which could explain some elusive bugs in scripts working with arrays. A final appendix summarises keyboard commands and other handy information.
I’m also grateful to Armin Briegel for confirming an important point about shells in Catalina, at least up to and including 10.15.1: whilst zsh is now the default when running a full installation of Catalina, when you boot in Recovery Mode, Terminal there still defaults to bash 3.2. This shouldn’t be a serious issue, unless you mount another volume and try running zsh scripts from there, for instance. That seems a curious decision by Apple, which may be corrected in a future update.
Moving to zsh, by Armin Briegel, is available now in Apple’s Books store.