Yesterday, at its WWDC developer conference, Apple unveiled the latest version of the MacOS operating system. Codenamed Catalina, it’s a fairly significant update for the platform, not least because of the changes that have taken place under the hood. Take, for example, the default shell, which has been migrated from Bash to Zsh.
Bash has been the primary macOS shell since OS X 10.2 Jaguar. For almost sixteen years, MacOS developers have used it to write scripts and issue commands to the underlying operating system. It’s deeply ingrained in how developers work. So, why the sudden change?
In a word: licensing.
For well over a decade, Apple has shipped macOS with a horrendously outdated version of GNU Bash. The default version on the last version of macOS, codenamed Mojave, is Bash 3.2. That dates back to 2007. For context, that’s the same year Apple unveiled the first iPhone.
Despite that, the Bash project is under active development. It reached a major milestone in January: version 5.0.
Newer versions of Bash are licensed under the GNU General Public License version 3 – or GPLv3 for short. This comes with several restrictions which could potentially have caused a few headaches for Apple further down the line.
Firstly, the GPLv3 include language that prohibits vendors from using GPL-licensed code on systems that prevent third parties from installing their own software. This controversial practice has a name: Tivoization, after the popular TiVo DVR boxes which are based on the Linux kernel, but only run software with an approved digital signature.
Secondly, the GPLv3 includes an explicit patent license. This can be hard to wrap your head around, but in a nutshell, it means that anyone who licenses code under the GPLv3 also explicitly grants a license to any of the associated patents. This isn’t a comprehensive licensing deal; it only applies to the extent required to actually use the code.
It also tries to protect users from licensing deals that only benefit some users. Here’s how the Institute for Legal Questions on Free and Open Source Software (IFROSS) describes it:
The new patent clause attempts to protect the user from the consequences of agreements between patent owners and licensees of the GPL that only benefit some of the licensees (corresponding to the Microsoft/Novell deal). The licensees are required to ensure that every user enjoys such advantages (patent license or release from claims), or that no one can profit from them.
These two clauses are likely the reason why Apple’s increasingly vary of GPL-licensed software, and is desperately trying to remove it from macOS. Between MacOS 10.5 Leopard and MacOS 10.12 Sierra, the number of GPL-licensed packages that came pre-installed decreased by an insane 66 percent – from 47 to just 16.
So, it’s no surprise that Apple’s moving its users away from Bash. I’m also not surprised to see Apple favor Zsh. For starters, it’s licensed under the MIT License, and therefore doesn’t contain the controversial language surrounding patents and Tivoization.
There’s also a solid (but not perfect) level of compatibility between Bash and Zsh, which should make the transition easy.
Zsh also comes with most of the features you’d expect from a modern shell. Given that macOS developers have been using a shell that’s older than a decent bottle of Scotch, this is obviously a huge selling point.
It’s also worth noting that macOS has come with Zsh for ages – it just hasn’t pushed it to developers. There’s absolutely nothing stopping you from getting familiar with right now.