Determining your shell - northwood-labs/macos-for-development GitHub Wiki
[!TIP] Initial setup: 1. Updating macOS • 2. Determining your shell • 3. Installing the Xcode CLI Tools • 4. Installing Homebrew
Every time you open a terminal session, that terminal is started with a particular shell. Knowing which one you're using will help you understand how to configure it.
Which shell?
You can run the following command to identify which shell you are currently running. This works for most shells.
echo $0
| Identifier | Description |
|---|---|
zsh |
Z-Shell |
bash or -bash |
Bash |
ksh |
KornShell |
csh or tcsh |
TCSH |
And you can discover where this shell is running from with the following command:
which $(echo $0 | sed -E 's,[^a-z],,g')
Other shells
Other shells exist, but they're not pre-installed in macOS. You'd likely be fully-aware that you're running a different shell. In which case, this page is likely not for you.
Where is my profile?
| Identifier | Profile | More info… |
|---|---|---|
zsh |
~/.zshrc |
https://apple.stackexchange.com/a/388623/8018 |
bash or -bash |
~/.bash_profile |
https://scriptingosx.com/2017/04/about-bash_profile-and-bashrc-on-macos/ |
ksh |
~/.profile |
https://access.redhat.com/solutions/452073 |
csh or tcsh |
~/.tcshrc |
https://www.oreilly.com/library/view/using-csh/9781449377526/ch04.html |