On macOS, #!/bin/bash means a script will use the system bash, which is very dated (3.2, 2006 year) and (for myself, at least) mostly useless.
Then you can install modern bash using Homebrew or MacPorts, and use something like this:
#!/usr/bin/env bash Then, the third approach is
#!/opt/homebrew/bin/bash But what if you run this script on a Mac where modern bash is installed using MacPorts instead of Homebrew?
What is the best practice here? (Maybe create a symlink in /usr/local/bin that points to /opt/homebrew/bin/bash, and then #!/usr/local/bin?)