Last active
August 21, 2026 03:54
-
-
Save netj/f76dffced1995a10a4c455d8418ed47d to your computer and use it in GitHub Desktop.
zprofile for using latest bash instead of zsh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ~/.zprofile for launching login shells to latest bash from Homebrew on macOS | |
| # Origin: https://gist.github.com/netj/f76dffced1995a10a4c455d8418ed47d | |
| # | |
| # If you still have old bash (3.x) as your shell, please change it to zsh before using this with: | |
| # chsh -s /bin/zsh | |
| source ~/.zshenv | |
| _switch_to_bash() { exec env SHELL=$(which bash) bash -il; } | |
| [ "$-" = "${-//[il]/}" ] || # don't interfere when not a login or interactive shell | |
| case "${TERM_PROGRAM-${TERMINAL_EMULATOR-}}---${__CFBundleIdentifier-}" in | |
| # to switch to bash only for known terminals, uncomment below: | |
| # # truly end-user interactive terminals | |
| # tmux---*) _switch_to_bash ;; | |
| # Apple_Terminal---com.apple.Terminal) _switch_to_bash ;; | |
| # Apple_Terminal---com.apple.Terminal) ;; | |
| # ghostty---*) ;; | |
| # # not ones running inside AI agents or IDEs | |
| # *---com.jetbrains.pycharm) ;; | |
| # JetBrains-JediTerm---*) ;; | |
| # zed---*) ;; | |
| # ---dev.zed.Zed) ;; | |
| # *) ;; | |
| ---*) ;; # unspecified terminal program, likely non-interactive probes (e.g., Zed) | |
| *) _switch_to_bash ;; # defaults to switching any interactive login shell to bash | |
| esac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # .zshenv for macOS | |
| eval "$(env -i /usr/libexec/path_helper -s)" | |
| export PATH=/opt/homebrew/bin:"$PATH" | |
| export PATH=/opt/homebrew/opt/coreutils/libexec/gnubin:"$PATH" | |
| export PATH=~/bin:~/.local/bin:"$PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment