mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-29 03:47:54 +00:00
bash: re-enable automatic bash shell detection
Bash shell detection was originally disabled in #1823 due to problems
with /bin/bash on macOS.
Apple distributes their own patched version of Bash 3.2 on macOS that
disables the POSIX-style $ENV-based startup path:
e5397a7e74/bash-3.2/shell.c (L1112-L1114)
This means we're unable to perform our automatic shell integration
sequence in this specific environment. Standard Bash 3.2 works fine.
Knowing this, we can re-enable bash shell detection by default unless
we're running "/bin/bash" on Darwin. We can safely assume that's the
unsupported Bash executable because /bin is non-writable on modern macOS
installations due to System Integrity Protection.
macOS users can either manually source our shell integration script
(which otherwise works fine with Apple's Bash) or install a standard
version of Bash from Homebrew or elsewhere.
This commit is contained in:
@@ -18,9 +18,6 @@ our integration script (`bash/ghostty.bash`). This prevents Bash from loading
|
||||
its normal startup files, which becomes our script's responsibility (along with
|
||||
disabling POSIX mode).
|
||||
|
||||
Because automatic Bash shell integration requires Bash version 4 or later, it
|
||||
must be explicitly enabled (`shell-integration = bash`).
|
||||
|
||||
Bash shell integration can also be sourced manually from `bash/ghostty.bash`.
|
||||
This also works for older versions of Bash.
|
||||
|
||||
@@ -31,6 +28,13 @@ if [ -n "${GHOSTTY_RESOURCES_DIR}" ]; then
|
||||
fi
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> The version of Bash distributed with macOS (`/bin/bash`) does not support
|
||||
> automatic shell integration. You'll need to manually source the shell
|
||||
> integration script (as shown above). You can also install a standard
|
||||
> version of Bash from Homebrew or elsewhere and set it as your shell.
|
||||
|
||||
### Elvish
|
||||
|
||||
For [Elvish](https://elv.sh), `$GHOSTTY_RESOURCES_DIR/src/shell-integration`
|
||||
|
||||
Reference in New Issue
Block a user