A note on unix shells for Mac OS X

hexley



chsh -s /bin/tcsh will change your shell to tcsh



Shell hell: Three or four unix shell programs are distributed with Mac OS X.  These are tcsh, bash and zsh; ksh joins the family with 10.4.x. Each has its own syntax, but tcsh is fundamentally different from the others.  Here are a couple of simple but essential examples of how the syntax differs:


operation
tcsh or csh syntax
zsh, bash, sh, ksh syntax
setting an environment variable (example)
setenv DISPLAY :0.0
export DISPLAY=:0.0
making an alias (example) alias calc "open -a calculator"
alias calc="open -a calculator"



You can see that the two sets of commands are incompatable.  If you did a new or clean install of OS X version 10.3.x, the default user shell is bash.  Bash is essentially an enhanced and GNU freeware version of the original Bourne shell, sh.  Unless you happen to like bash, I recommend either switching to tcsh or zsh.

If you are using OS X version 10.2.x, 10.1.x or 10.0.x, the default user shell is tcsh.  tcsh is an enhanced version of csh, the "c-shell," which is more user-friendly than the Bourne shell but early implementations were buggy.

Many of us who are long-time tcsh users will be uncomfortable with bash.  Many crystallography programs (like cns) seem to make the assumption that you are a tcsh user.  (I've set up all the fink-installable programs to work with any shell.) If you are used to tcsh syntax and suddenly find yourself using bash, this will be problematic.  I find bash as a user shell a bit uncomfortable, and prefer tcsh or zsh.  I have in fact made zsh my default user shell.  zsh is the most user-friendly of all the shells, as well as the most powerful.  (It is an enhanced version of ksh, but with all the user-friendly functionality of tcsh plus lots of other great things like recursive globbing, remote file completions, a whole bunch of really useful functions that are included, etc.).

If you want to return to being a tcsh user, or become a zsh user, just type the following:

chsh -s /bin/tcsh
or
chsh -s /bin/zsh



Altertnatively, find the application called Netinfo Manager in /Applications/Utilities.  Open it up, and click on the padlock to authenticate.  Then in the central colum, click on "users" and select the user name of the user whose shell you want to change.  Then replace /bin/bash with either /bin/tcsh or /bin/zsh.  Save the change.