Unexpectedly using /bin/bash to execute a (startup) command on MacOS #5114
Unanswered
chernetskyi
asked this question in
Ideas and Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While debugging an issue I found out that Ghostty unconditionally uses
/bin/bash
to execute a (startup) command on MacOS. This came as a surprise to me after reading the documentation:From the code, however, it's clear neither
SHELL
nor thepasswd
entry are respected:ghostty/src/termio/Exec.zig
Line 1001 in 3f7c3af
I suggest documenting this behavior to avoid further questions.
Now, personal story.
I use ZSH as my default/login shell on a Linux machine, but Ghostty launches fish. I keep my environment variables configuration in
.zshenv
to make them available to both POSIX-compliant shell scripts (executed by ZSH) and interactive sessions in fish (by inheriting variables from ZSH).However, the same solution did not work on MacOS. Homebrew-installed fish failed to launch because
PATH
was not updated for/bin/bash
.The comments around those lines of code indicate that MacOS is a mess, but it would've been nice to have an option to change Bash to some other shell. For example, by switching to
/bin/sh
, which re-execs as Bash, Dash, or ZSH according to MacOS' man pages.In the meantime, I'll consider moving my
export
s to.bash_profile
because apparently Bash outperforms ZSH.UPD: missed the
--noprofile
and--norc
flags. Looks like the absolute path and environment variable duplication is the only way to go at the moment.Beta Was this translation helpful? Give feedback.
All reactions