Skip to content

Conversation

@JamesGuthrie
Copy link
Contributor

While /bin/bash does exist on many platforms, it's not guaranteed to be the case. One prominent example is NixOS. The portable way to invoke scripts is to use #!/usr/bin/env bash which finds the most appropriate bash binary from the user's configured PATH.

While /bin/bash does exist on many platforms, it's not guaranteed to be
the case. One prominent example is NixOS. The portable way to invoke
scripts is to use #!/usr/bin/env bash which finds the most appropriate
bash binary from the user's configured PATH.
@KevinGimbel
Copy link
Contributor

This is important!

On macOS /bin/bash is a very outdated version of Bash due to licensing, which is why macOS switched to zsh.

Take the following from my Mac running macOS 26.1:

/bin/bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin25)
Copyright (C) 2007 Free Software Foundation, Inc.
/usr/bin/env bash --version
GNU bash, version 5.3.3(1)-release (aarch64-apple-darwin24.4.0)
Copyright (C) 2025 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I can (and did) install a newer version myself, but /bin/bash is still the outdated old version macOS ships with.

@alecthomas
Copy link
Collaborator

@KevinGimbel the version of bash installed on your laptop is irrelevant to Hermit. It deliberately doesn't require any functionality more recent than the versions on Mac.

@alecthomas
Copy link
Collaborator

@JamesGuthrie I'll fix that failure.

version "4.4-temporary" {
on "unpack" {
run {
cmd = "/bin/ln -s ${root}/bin/make ${root}/make"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cmd deliberately requires explicit paths so that it doesn't search the $PATH and have the wrong binary injected. This basically circumvents that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants