Find out which Bash version you're currently using # check current Bash version bash -version # output: # GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23) # locate current Bash which -a bash # output /bin/bash Upgrade your Bash version to 5.x or above brew install bash # locate bash installations which -a bash # output /opt/homebrew/bin//bash /opt/homebrew/bin/bash /bin/bash # put this near the top of your `/.zshrc` to ensure this is the first PATH that is declared export PATH="/opt/homebrew/bin/:$PATH" # check new Bash version bash -version # output: # GNU bash, version 5.2.37(1)-release (aarch64-apple-darwin23.4.0) When writing a Bash file # ensure you use this #!/usr/bin/env bash # Don't use this. It's not portable across different machines #!/bin/bash