macOS Catalina Switches Default Shell From Bash to Zsh. But Why?

When macOS 10.15 Catalina lands this Fall, it will have a new default shell in Zsh. Currently, macOS users have Bash as the default, so why did Apple switch to Zsh… and will it matter?

Both Zsh and Bash are iterations on the Bourne Shell, which was the original command-line interpreter for Unix-based operating systems. Bash, which is short for “Bourne-again shell,” is the most common shell script. Microsoft recently refreshed its Terminal app with a heavy dollop of Bash support.

Apple’s documentation doesn’t provide much insight on why it’s making the switch. It simply says Zsh will be the new default shell for “newly created user accounts,” and that Bash will remain the defualt shell for macOS Mojave and earlier.

In most cases, it won’t make a difference. Zsh and Bash are highly compatible, though Apple cautions us to “be aware that scripts that make use of bashisms may not work properly.” Still, it’s unlikely any changes made in Terminal with Bash would see a system-crashing instance when you switch to Zsh. (If you want to give it a shot, head into the Apple Menu > System Preferences > Users & Groups > click the lock icon > control-click your name in the list of users > Advanced Options > Login shell > Zsh > OK.)

Scripts that are written for Bash can be used in Zsh, but likely require a shebang line like #!/bin/bash or #!bin/bash/sh to execute properly.

Like Bash, Zsh supports plugins. It’s also a touch more user-friendly, which is probably one reason Apple moved to it. While fairly basic, Terminal can be intimidating. Zsh can help; it supports automatic change-directory commands, which helps users find files buried deep in a hierarchal tree faster. Zsh also has recursive path expansion, so typing u/lo/b expands automatically to user/local/bin. Spelling errors are caught, and the new shell for macOS Catalina will know cd/donloads was really cd/downloads.

But there’s one more thing to consider: scripting. About Xcode 11 beta, which launches with Catalina, Apple has this to say:

Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with legacy software. In future versions of macOS, scripting language runtimes won’t be available by default, and may require you to install an additional package. If your software depends on scripting languages, it’s recommended that you bundle the runtime within the app.

Apple also writes that Xcode’s debugger, LLDB, has new Python Scripting based on Python 3. The system was shipping Python 2.7, and Apple now says: “Use of Python 2.7 isn’t recommended. This version is included in macOS for compatibility with legacy software. Future versions of macOS won’t include Python 2.7. Instead, it’s recommended that you run python3 in Terminal.”

There’s still a lot of speculation on the underlying reason for this maneuver. Casual Terminal users won’t notice much of a difference (except that Terminal is perhaps a bit less scary). Power users can still do the things they like, but the platform might require some added manipulation here and there. As for the “why” in all of this, it seems the move to Zsh simply made it easier for Apple to have an extensible, customizable shell environment. We’ll just have to wait to see what that means for future iterations of macOS.

One Response to “macOS Catalina Switches Default Shell From Bash to Zsh. But Why?”