How do I fix Terminal.app when my shell has been set to an illegal value? Today I was mucking about trying to uninstall macports when I noticed an error being thrown up whenever I used sudo. I killed Terminal and tried to restart it which failed with the error message "You're are not authorized to run this application" and "The administrator has set your shell to an illegal value." How can I fix this?
…I'd already resolved the issue using Disk Utility to repair permissions…


If repairing permissions clears up the problem, the cause is (almost certainly) that the permissions of /etc/shells were incorrect, preventing Terminal from reading it.

/etc/shells contains a list of valid shell programs, and Terminal checks to see whether the shell for your user account is listed. If not, it produces the “illegal shell” message. If it can’t read the /etc/shells file due to permission issues, it also produces this message.

More rarely, some people have encountered this problem when the /etc/shells file was somehow altered so that it is empty, in which case you’ll need to restore its contents by copying it from a good system, or with a Time Machine restore, etc.

To answer your original question:

If Terminal complains about an “illegal shell” it means that the shell for your user account was not found in /etc/shells.

You can see which shells are considered valid with cat /etc/shells.

You can check which shell your user account is set to use with echo $SHELL, or by reading the user information with dscl . -read "/Users/$LOGNAME" UserShell. Or you can use System Preferences:


Open System Preferences and go to Users &amp; Groups.
Click on the lock and enter your password to be able to read/set user settings.
Control-Click (or Right-Click) on your user to get a contextual menu and choose Advanced Options….


The Advanced Options sheet displays detailed user account information including the shell pathname. You can also use this to edit the shell pathname to re-enable logins if it has been set to a value not listed in /etc/shells.