Macos – What happens exactly when I type ‘bash’ on the Terminal command line on Mac OSX

command linemacmacos

I have an alias that I've added to .bashrc, and it only activates in Terminal after I run the 'bash' command. I feel like I should know what's happening here, but I don't. 🙂

Best Answer

Depending on the version of OS X you are using your default shell might not be bash. You can verify this by typing(before you run 'bash'):

$ echo $SHELL
/bin/zsh

You can change your default shell to bash so you don't have to keep running the command by following the instructions here:

https://serverfault.com/questions/21044/how-do-i-change-a-users-default-shell-in-osx

From @chopper3

for <=10.4 - netinfo manager, /users/whoever/shell

for 10.5=> - SysPrefs, accounts, control-click on user, select advanced options, edit login shell field.

To further answer your question, the .bashrc is only used by the bash shell. If you want you can figure out what shell you are using and add the alias to the .tcshrc or .zshrc instead of changing everything to use bash.

More info on what a shell is:

http://en.wikipedia.org/wiki/Shell_(computing)

and bash specifically:

http://en.wikipedia.org/wiki/Bash_(Unix_shell)

Related Question