Which shell I am using in mac

59,693

Solution 1

macOS's Terminal allows you to specify the shell in its preferences. By default, it is set to use your login shell, but it looks like you've overridden it to use Bash.

In the General tab of Terminal's preferences, set it to "Default login shell," to prevent your login shell from being overridden:

Terminal's settings

Also, make sure the "Run command" checkbox is not checked in the Shell tab of your profiles' settings:

Profile settings

Solution 2

Assuming you're using the standard Terminal.app and you've verified that it is indeed configured to use your default login shell, as described in NobodyNada's helpful answer:

To see what shell is currently running (which may or may not be your default shell), use:

ps -o comm= $$

To see what shell is your default shell, run:

echo $SHELL

Solution 3

Just type in any terminal you have open:

echo $0

And the name of the terminal will appear:

enter image description here

Share:
59,693
shantanu
Author by

shantanu

Updated on July 08, 2022

Comments

  • shantanu
    shantanu almost 2 years

    Default shell in my mac was bash.
    I have tried to change it into ZSH by command chsh -s /bin/zsh.

    Now when I am trying to check the shell type, I am getting different responses.

    COMMAND-1

    input : echo $SHELL
    output : /bin/zsh

    COMMAND-2

    input : ps $o
    output : 7655 ttys002 0:00.03 -bash

    COMMAND-3

    input : ps -p $$ | awk '$1 == PP {print $4}' PP=$$
    output : -bash

    I am not sure which shell I am using. Do I need to do something additional to change my shell into ZSH.

  • Charlie Parker
    Charlie Parker over 2 years
    how do I additionally make sure that my .zshrc file is being ran? I don't see my aliases working as of right now...
  • Charlie Parker
    Charlie Parker over 2 years
    the general settings - as of right now 2021 december - have changed
  • mklement0
    mklement0 over 2 years
    @CharlieParker, if zsh is your default shell, ~/.zshrc should automatically be sourced in interactive sessions. You can place an echo command in there to diagnose. If you need further help, please create a new question post.