Ghostty Shell Configuration Guide | Generated by AI
Ghostty and .bashrc on Ubuntu
Ghostty behaves similarly to the default GNOME Terminal on Ubuntu (and other Linux distros) when it comes to loading .bashrc. By default, Ghostty starts non-login interactive shells for bash, which means it sources ~/.bashrc directly—just like GNOME Terminal. This is the standard behavior for most Linux terminals, where .bashrc handles interactive shell setup (e.g., aliases, prompts, environment variables for non-login sessions).
How It Loads .bashrc
- When you open a new Ghostty window or tab, it executes
bash(or your default shell) as a non-login shell. - Bash checks for and sources
~/.bashrcif the shell is interactive (which it is by default). - If you have a
~/.bash_profile(typically for login shells), it won’t be sourced unless you explicitly configure Ghostty to start a login shell (e.g., by addinginitial-command = bash --loginto~/.config/ghostty/config). - Potential issues: Some users report
.bashrcnot loading on first launch for new users or in specific setups (e.g., remote SSH sessions on Ubuntu). This can often be fixed by ensuring no conflicting~/.bash_profileexists, or by manually sourcing it in your config. Adding a guard in.bashrclike[[ $- != *i* ]] && returncan prevent issues in non-interactive contexts.
In short, yes—Ghostty is the same as the default Terminal for using .bashrc on Ubuntu, with the same non-login default.
Ghostty on macOS: .zprofile or .bash_profile?
On macOS, Ghostty follows the platform’s tradition (like Terminal.app) and starts login shells by default, regardless of the shell. This affects which profile loads:
- If using zsh (macOS default since Catalina): It sources
~/.zprofile(for login setup) and~/.zshrc(for interactive setup) every time a new terminal opens. - If using bash: It sources
~/.bash_profile(login shell). Bash won’t source~/.bashrcdirectly here—~/.bashrcis only for non-login interactive shells. To include.bashrccontent, add this to your~/.bash_profile:if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
So, it loads ~/.zprofile for the default zsh setup, or ~/.bash_profile if you’re using bash. You can switch shells or tweak via Ghostty’s config if needed.
Shell Integration - Ghostty
macOS Login Shells - Ghostty
Potential bug, .bashrc not read on startup - GitHub Discussion
Bash Startup Files - GNU Manual