Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, iphone help, ipod help, AdSense, MySpace, Sony PSP help, Mp3 players, Windows XP, Windows Vista, Linux, SEO, Mac OS X, Facebook, Twitter and LinkedIn.

How do I change my default shell in Mac OS X Panther from tcsh to bash?

Hi Dave! I'm running a 500 MHz Titanium Powerbook with 512MB of memory, Mac OSX 10.3.7. I recently had to do a clean install on my powerbook and my shell is defaulting to the tcsh instead of the bash. First question... Why did it do that? Second question... How do I fix it?


Dave's Answer:

Hi and thanks for your message! I used to have a Titanium Powerbook until it fell off my desk and the hinge shattered. A cool $1200 repair bill made me decide to just upgrade to the Aluminum unit. But that's not what you're asking about, is it? :-)

There are two types of clean install with Mac OS X: there's the clean install that says "I already have accounts, just install all the OS and application program" (it's "clean" because you have all your old preferences, etc, removed) and then there's the really clean install which is "my disk is blank. I need something to fill it up. help." I surmise that the latter is what you found yourself doing.

Apple might have been fiddling with things in 10.3.7 because starting with Panther, the default shell for a brand new account is supposed to be Bash (much to the unhappiness of the tcsh faithful). Why yours ended up with tcsh again, which was from back on the 10.2.x days, I can't explain.

The good news is that it's easy to fix it. You can do this two different ways. If you really want to fix your default login shell, you'll need to go into the NetInfo Manager program (Applications -> Utilities -> NetInfo Manager). Click on "users" then find your account. In the lower pane is "shell" and it's doubtless set to "/bin/tcsh". Click on the value and change it to /bin/bash, then quit NetInfo Manager to have it set in the database.

Note: if all the field values are greyed out, you need to click on the little lock icon on the bottom of the Window to allow you to edit the fields herein. Don't monkey around with other values while you're in the program, though, because you can really mess up your system!

If you don't want to change the NetInfo database entry for your account, an easier alternative is to go into the Terminal application (Applications -> Utilities -> Terminal) then go to Terminal -> Terminal Preferences and select "Execute this command" and make sure it's the shell you want, as shown here:

Mac OS X Panther Terminal Application Preferences

Which do I recommend? Neither, particularly. Both work well and both accomplish what you want. Oh, alright, since I sometimes ssh into my Mac from other systems, I'd lean more towards changing the NetInfo database entry so that all shells you get have the right command shell, not just those within the Terminal application. Anyway, this'll fix your problem, I'm sure.



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

Or you could simply run:

$ /usr/bin/chsh -s /bin/bash <-- for bash

or

$ /usr/bin/chsh -s /bin/tcsh <-- for tcsh

Any valid shell in /etc/shells can be used.

Posted by: John Bales at January 13, 2005 11:28 PM

Except the chsh command changes entries in the /etc/passwd file, and that's not the file that Mac OS X uses for account information management. Really. Here's my /etc/passwd file from a system that has five user accounts:

nobody:*:-2:-2:Unprivileged User:/nohome:/noshell
root:*:0:0:System Administrator:/var/root:/bin/tcsh
daemon:*:1:1:System Services:/var/root:/noshell
smmsp:*:25:25:Sendmail User:/private/etc/mail:/noshell
www:*:70:70:World Wide Web Server:/Library/WebServer:/noshell
mysql:*:74:74:MySQL Server:/nohome:/noshell
sshd:*:75:75:sshd Privilege separation:/var/empty:/noshell
unknown:*:99:99:Unknown User:/nohome:/noshell

Not a single user account in the list.

Posted by: Dave Taylor at January 13, 2005 11:58 PM

Actually, reading the man page for chsh, I think you're right and I'm wrong. It looks like chsh works with NetInfo (at least, with a local copy of NetInfo if you're in a networked environment) so you could indeed just type:

$ chsh -s /bin/bash $LOGNAME

on the command line to change your shell. MUCH easier than messing with NetInfo Manager!

Posted by: Dave Taylor at January 14, 2005 12:03 AM

Nice tip, Mr. Bales. Thank you for the concise answer.

Posted by: Travis Cripps at January 27, 2006 12:50 PM


I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Uniblue: Free Virus Scan

Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Member of the B5Media Network

Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]