5

I installed bash 4.0 via MacPorts, then used sudo chsh -s /opt/local/bin/bash my_user to change my shell.

Before that I tried just running plain chsh without sudo, but it wouldn't allow me to change my shell to that path.

Now when I try to start Terminal I'm getting a message that my shell has an illegal value, so Terminal won't start. I click Quit, and, unsurprisingly but annoyingly, it quits immediately.

lame terminal

  1. How do I reset my shell so I can start Terminal again?
  2. How do I set my shell to bash installed via MacPorts in a way that it'll work?
  3. Why does Terminal think my shell is illegal anyway? Is it siding with the neo-prohibitionists?

Mac OS X 10.5.8. Everything super mega up-to-date.

Gareth
  • 19,080
kch
  • 2,272

5 Answers5

14

Another method to change your shell (akin to the chsh command but using a GUI) for your user profile is to do the following:

  1. Open System Preferences.app
  2. Go to the Accounts Preference Pane
  3. If required unlock the padlock
  4. Hold control and click or right click on your account in the list of accounts.
  5. Choose Advanced Options...
  6. Change the value where it says Login shell: to the path to the bash shell you want to use.

I would recommend resetting it back to /bin/bash and then in the Terminal ensure that /opt/local/bin/bash works correctly by running /opt/local/bin/bash before attempting to change it again.

As to why it was saying you weren't allowed is that Mac OS X keeps a list of "allowed" shells in /etc/shells/ so you'll need to edit that file and add /opt/local/bin/bash to that list as well.

Chealion
  • 26,327
6

The problem here is the /etc/shells file. This file contains a list of all shells that are allowed to be used as login shells. If you want to use the MacPorts-installed bash, you should edit this file to include the path to that particular shell.

1

I got the same issue after update to Lion.

You should look in the /etc you may find a file like shells~orig and shells. Restore the shells~orig to shells.

Good luck.

oko
  • 11
0

I messed up here myself, and found an alternative method. If you have iTerm installed, you can edit your profile to choose a custom startup command.

Go to Profiles -> Open Profiles, select a profile (normally "Default"), and then hit the "Edit Profiles" button.

From there, you can chose a custom startup command such as "/bin/zsh" to restore normality and fix everything up.

iTerm screenshot

Markus Meyer
  • 1,910
0

Open ~/Library/Preferences/com.apple.Terminal.plist and set the "Shell" key to "/bin/bash", then retry opening Terminal. If this doesn't work, X11.app may be able to open a terminal. Otherwise you'll be stuck making a new user with admin privs and reset your shell there.

Make sure /opt/local/bin/bash is executable by running it in Terminal. If not:

chmod +x /opt/local/bin/bash

Also, /opt/local/bin/bash should be a line in /etc/shells.

ACoolie
  • 879