Skip to Content

Bash by the Numbers

Platforms and versions, out of the box

Introduction

Bash is old for a “modern” shell – since its original release in 1989, it’s grown to become the de facto default shell in all major (commercial) Linux distributions. Starting with Mac OS X 10.2 (“Jaguar”, released in 2002) until macOS 10.15 (“Catalina”, released in 2019), it was also the default shell on all modern Macintosh computers. This has made it a “safe” target when building tools as shell scripts but this has also led to feature-sprawl due to the different versions of Bash a user may encounter “in the wild”.

As a career UNIX administrator, I’ve “kind-of” known which version would be on any given platform but I’ve never seen a cut-and-dried list before. So I’ve assembled a broad reference, listing major release dates and versions by platform. I’ve also included some addenda related to the state of Bash on macOS.

Table of Contents

Major Release Dates

There are 3 major versions of Bash that a user is likely to find in a default installation of almost any modern Linux distribution or any version of macOS released to date but see the addenda for more information about how this will change (possible as soon as macOS 12 Monterey):

Bash 3

Bash 4

Bash 5

Versions by Platform

I’ve focused on the major server & development platforms that are freely available; this means that unfortunately fully commercial Linux platforms like SUSE Linux Enterprise Server and Oracle Linux are not represented. This also means that as a major development platform, macOS is included but similarly mixed-source platforms like Solaris, AIX, and HPUX are omitted.

What about freeBSD, etc?

The three major BSD platforms (freeBSD, openBSD, netBSD) are not represented because they do not ship bash by default, but as an add-on port or package.

Similarly, Linux distributions that do not ship bash by default or that do not pin versions to specific OS releases are also not represented, e.g. Alpine Linux, Gentoo, etc.

Debian

Platform Bash Version License
Debian 10 (Buster) 5.0.3 GPLv3+
Debian 11 (Bullseye) 5.1.4 GPLv3+
Debian 12 (Bookworm) 5.2.15 GPLv3+

Ubuntu

Note: only LTS releases are represented here.

Platform Bash Version License
Ubuntu 16.04 (Xenial Xerus) 4.3.48 GPLv3+
Ubuntu 18.04 (Bionic Beaver) 4.4.20 GPLv3+
Ubuntu 20.04 (Focal Fossa) 5.0.17 GPLv3+
Ubuntu 22.04 (Jammy Jellyfish) 5.1.16 GPLv3+
Ubuntu 24.04 (Noble Numbat) 5.2.21 GPLv3+

CentOS & Red Hat Enterprise Linux

CentOS has been discontinued as of the end of 2021, and AlmaLinux has now taken on the role of a community-supported Linux distribution that is binary-compatible with Red Hat Enterprise Linux.

Platform Bash Version License
CentOS/RHEL 6 4.1.2 GPLv3+
CentOS/RHEL 7 4.2.46 GPLv3+
CentOS/RHEL 8 4.4.19 GPLv3+
AlmaLinux/RHEL 8.5 4.4.20 GPLv3+
AlmaLinux/RHEL 9 5.1.8 GPLv3+

Amazon Linux

Amazon Linux was initially derived from RedHat Enterprise Linux and maintains binary compatibility with RHEL. I find the versioning about as confusing as Debian and Ubuntu code names, but starting with Amazon Linux 2023, there is a 2 year version cadence like other enterprise distributions.

Platform Bash Version License
2023 5.2.15 GPLv3
2 4.2.46 GPLv3
1 4.2.46 GPLv3

macOS

It’s Bash 3. They’re all Bash 3.

Platform Bash Version License
macOS 10.15 (Catalina) 3.2.57 (deprecated) GPLv2
macOS 11 (Big Sur) 3.2.57 (deprecated) GPLv2
macOS 12 (Monterey) 3.2.57 (deprecated) GPLv2
macOS 13 (Ventura) 3.2.57 (deprecated) GPLv2
macOS 14 (Sonoma) 3.2.57 (deprecated) GPLv2
macOS 15 (Sequoia) 3.2.57 (deprecated) GPLv2

macOS Addenda

macOS has shipped a very stale version of Bash for a long time

All currently supported versions of macOS ship with Bash 3.2, which is the last semi-major release of Bash that shipped under the terms of the GNU General Public License, version 2 (GPLv2).

It is believed (Matthew, Roben) that this is due to the re-licensing of Bash 4 to the GNU General Public License, version 3 (GPLv3+), which includes a clause pertaining to covering the licensed work under “any later version”. The GPLv3 has faced numerous criticisms, any of which would potentially be considered reasonable grounds for Apple to avoid distributing contemporary versions of Bash. To the best of my knowledge, Apple has never issued a statement on the matter, simply allowing all utilities shipped under the GPL to go stale or replacing them outright with new alternatives.

macOS 10.15 (Catalina) has deprecated Bash as the default shell

Apple has begun making plans for major changes in the way that development tools are packaged and distributed for macOS. Along with preparing to deprecate bundled scripting environments like Ruby and Python, Apple has changed the default shell for new users from bash to zsh. This change should not affect existing user accounts or accounts preserved during OS updates (or restored from appropriate backups), but all instances of bash -l in macOS 10.15 will now display the following message during every login session initialization1:

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.

Versions of macOS prior to macOS 10.15 provided /bin/sh as a copy of /bin/bash (but explicitly not a hard link – note the differing inodes of the two files in the following example). This is confirmed by requesting the man page for sh, which brings up the man page for bash:

~ $ sw_vers -productVersion
10.14.6
~ $ ls -lhi /bin/sh /bin/bash
22763200 -r-xr-xr-x  1 root  wheel   604K May  4  2019 /bin/bash
22763250 -r-xr-xr-x  1 root  wheel   604K May  4  2019 /bin/sh
~ $ man 1 sh | awk 'NR==1{print $1}'
BASH(1)

However, macOS 10.15 changes this behavior: /bin/sh is now a symbolic link to /private/var/select/sh, which itself is a symbolic link to any of three possible POSIX-compliant interpreters. This change is relatively well documented in the local man pages:

sh is a POSIX-compliant command interpreter (shell). It is implemented by re-execing as either bash(1), dash(1), or zsh(1) as determined by the symbolic link located at /private/var/select/sh. If /private/var/select/sh does not exist or does not point to a valid shell, sh will use one of the supported shells.

Default behavior in macOS 10.15 and above is that the file /private/var/select/sh is a symbolic link to /bin/bash and extra care should be taken to ensure that any scripts which use #!/bin/sh are not utilizing unintentional bashisms. All of the default shell interpreters are single-linked files by default:

~ $ sw_vers -productVersion
10.15.2
~ $ ls -hl /bin/sh
-rwxr-xr-x  1 root  wheel   31K Dec  5 01:33 /bin/sh
~ $ ls -hl /bin/bash
-r-xr-xr-x  1 root  wheel   609K Dec  5 01:33 /bin/bash
~ $ ls -hl /bin/dash
-rwxr-xr-x  1 root  wheel   108K Dec  5 01:33 /bin/dash
~ $ ls -hl /bin/zsh
-rwxr-xr-x  1 root  wheel   618K Dec  5 01:33 /bin/zsh
~ $ ls -hl /private/var/select/sh
lrwxr-xr-x  1 root  wheel   9B Oct 10 20:50 /private/var/select/sh -> /bin/bash

  1. This can be disabled using an environment variable, BASH_SILENCE_DEPRECATION_WARNING ↩︎