Install Bash 5 on macOS with Patches

I recently posted an article on how to download, install, and build a macOS installer pkg for bash 5. In that first version of this post I ignored patches, minor updates to the bash source code and binary. But as the patches to bash 5 are accumulating, I cannot ignore them much longer.

This post will extend the instructions in the original post.

After downloading and expanding the bash-5.0.tar.gz, create a patches folder:

$ cd path/to/bash-5.0
$ mkdir patches
$ cd patches

You can download the patches for bash-5.0 here. As of this writing, there are seven patches for bash-5.0 labelled bash50-001 through bash50-007. You can download all at once with:

$ curl 'https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash50-[001-007]' -O

(Adapt the numbers when there are more patches in the future.)

Then move up one directory level to the bash-5.0 root directory and apply the patches using the patch command.

$ cd ..
$ patch -p0 -i patches/bash50-001
$ patch -p0 -i patches/bash50-002

(etc.)

You can download and patch with a single step. Make sure your working directory is the bash-5.0 with all the code and run:

$ curl 'https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash50-[001-007]' | patch -p0

From here, you can continue with the remaining build steps from the original post. The next step will be running ./configure.

The script to build the pkg installer has also been updated in the repository to download and apply the patches before building.

Published by

ab

Mac Admin, Consultant, and Author

2 thoughts on “Install Bash 5 on macOS with Patches”

  1. Checking in https://ftp.gnu.org/gnu/bash/bash-5.0-patches/ there are now 10 more patches since you posted this write-up. I realize I can change
    curl ‘https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash50-[001-007]’ -O
    to
    curl ‘https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash50-[001-017]’ -O
    but that still leaves the question which bash version to d/l? At the site for bash download, there are two 5* versions: 5.0.5 & 5.1
    I noticed too they’re only one day apart timestamp. I’m just trying to get it right the first time around without messing up anything on my Macbook. I’m currently locked down quarantined abroad with a not so great internet connection & would hate to mess up my system before I can hopefully finally get back stateside. đŸ™‚ Thanks for any help you can give me.

    1. yes, you are correct regarding the command for downloading the patches. But I don’t see two bash versions on the download, there is only bash-5.0 and the folder for the patches. (readline-5.1 is _not_ the same as bash)

Comments are closed.