Skip to content

Commit 0683424

Browse files
authored
🤖 fix: replace /bin/bash with /usr/bin/env bash for portability (#603)
Replace hardcoded `/bin/bash` shebangs with `/usr/bin/env bash` for better portability across different systems, particularly NixOS where `/bin/bash` does not exist. ## Changes - **Makefile**: Update SHELL variable for non-Windows systems - **docs/init-hooks.md**: Update example script shebangs (2 occurrences) - **scripts/setup-macos-signing.sh**: Update shebang - **vscode/scripts/create-icon.sh**: Update shebang ## Why `/usr/bin/env bash` resolves bash from PATH, making scripts work on systems where bash is not in `/bin` (e.g., NixOS installs bash in `/nix/store/...`). This is a standard practice for portable shell scripts. _Generated with `mux`_
1 parent 3df3beb commit 0683424

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
# Branches reduce reproducibility - builds should fail fast with clear errors
2525
# if dependencies are missing, not silently fall back to different behavior.
2626

27-
# Use PATH-resolved bash on Windows to avoid hardcoded /usr/bin/bash which doesn't
28-
# exist in Chocolatey's make environment or on GitHub Actions windows-latest.
27+
# Use PATH-resolved bash for portability across different systems.
28+
# - Windows: /usr/bin/bash doesn't exist in Chocolatey's make environment or GitHub Actions
29+
# - NixOS: /bin/bash doesn't exist, bash is in /nix/store/...
30+
# - Other systems: /usr/bin/env bash resolves from PATH
2931
ifeq ($(OS),Windows_NT)
3032
SHELL := bash
3133
else
32-
SHELL := /bin/bash
34+
SHELL := /usr/bin/env bash
3335
endif
3436
.SHELLFLAGS := -eu -o pipefail -c
3537

docs/init-hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Add a `.mux/init` executable script to your project root to run commands when cr
55
## Example
66

77
```bash
8-
#!/bin/bash
8+
#!/usr/bin/env bash
99
set -e
1010

1111
bun install
@@ -40,7 +40,7 @@ Init hooks receive the following environment variables:
4040
**Note for SSH workspaces:** Since the project is synced to the remote machine, files exist in both locations. The init hook runs in the workspace directory (`$PWD`), so use relative paths to reference project files:
4141

4242
```bash
43-
#!/bin/bash
43+
#!/usr/bin/env bash
4444
set -e
4545

4646
echo "Runtime: $MUX_RUNTIME"

scripts/setup-macos-signing.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
# Sets up macOS code signing and notarization from GitHub secrets
33
# Usage: ./scripts/setup-macos-signing.sh
44
#

vscode/scripts/create-icon.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
# Create icon.png from the cmux logo for the VS Code extension
33

44
set -e

0 commit comments

Comments
 (0)