Why doesn't the root user on OSX automatically default to the same shell as other users?

Seems like this would avoid a lot of complications, but I guess there must be complications with the shells being the same for root as others, but I just don't know what they are. I have googled this and searched Stack Exchange, and have not found an explanation for it.

  • based on your comments on one of the answers, it sounds like what you really want to know is how to change root's shell. if you want to know how to switch shells, I suggest you ask a new question about how to change the shell of the root user. That question is a much better fit for this site than a "why" question, as it is a problem that admits a solution. Honestly, if you want to know why Apple did something, only Apple developers will know for sure -- at present your question calls for speculation, and thus isn't a wonderful fit for this site.
    – D.W.
    Commented Mar 27, 2015 at 21:26
  • incorrect. I changed the shell, by finding a command in another thread. I understand the command only enough to know it changed the shell and picked the some settings I like to run. The command was not "change shell to bash" but something I did not recognize. I assure you, I asked the question I want an answer for.
    – DanAllen
    Commented Mar 27, 2015 at 21:38
  • If you actually want an answer to the "why" question, please edit it to clarify: 1. Are you asking why, if a user changes their shell, the root shell doesn't also change? (That's how I interpreted it.) Or are you asking why the default shell for root is different from the default shell for non-root users, initially? 2. Specifically what complications do you anticipate would be avoided if the default settings were different? 3. Please clarify on specifically what you are asking. I'm having a hard time extracting what the specific question is.
    – D.W.
    Commented Mar 27, 2015 at 21:39
  • Specific complication was I wanted the settings I have in bash to work for the root user. So I switched the shell and copied a few files from the my home directory to the root's home directory to get the resullt I wanted. It seemed like a hassle and I want to know why the root user does not default to the same shell as other users.
    – DanAllen
    Commented Mar 27, 2015 at 21:41
  • Anyway, once you have worked out how to clarify your question, please edit the question to reflect this. The site design might not make this clear, but comments exist only to help you improve the question and can disappear at any time. You shouldn't drop clarifications solely in the comments, and readers shouldn't have to read the comments to understand your question. See the help center for more on how to use this site effectively.
    – D.W.
    Commented Mar 27, 2015 at 21:45

2 Answers 2


On my system (OS X 10.10 Yosemite), root is configured to use a /bin/sh shell by default (in both /etc/passwd and through OpenDirectory). Other users (aside from daemons) are configured to use /bin/bash by default.

There is no significant difference between the two in everyday usage, although Bash has had some high profile security issues lately (reference: ShellShock and the Apple security patch at https://support.apple.com/en-us/HT201393). Maybe Apple made the choice to set root's default shell to /bin/sh by default, in light of that?

  • maui, is defaulting the root to sh a recent change? Did it used to be different?
    – DanAllen
    Commented Mar 27, 2015 at 21:33
  • Looking back at some older articles in Macworld (circa Feb 2010 - Snow Leopard era), I can see that the examples given of the root shell were Bash. See macworld.com/article/1146550/rootprompt.html . That said, my comment was just a guess that was correct, at least in this case.
    – MauiAggie
    Commented Mar 31, 2015 at 21:58

Probably because on standard Unix operating systems, each user has its own shell, and root is just another user. Mac OS X is more or less Unix-derived. So, lacking any sufficiently powerful reason to change that, it's not surprising that Mac OS X follows Unix conventions.

And it would be very surprising if changing bob's login shell also changed root's login shell. That'd be a security risk (ordinary users shouldn't be able to change root's login shell), could cause system stability problems (if you choose a bad login shell or one that is on an external partition), and would violate the principle of least surprise.

Also, probabilistically speaking, I suspect that most users who know enough to log in as root, also know enough to be able to change root's shell to whatever you prefer.

But only Apple can tell you for sure why they did it this way. The rest of us can only speculative.

  • The question asked "doesn't automatically default to the same shell" which is not the same as user having its own shell - However as you say "if you know enough to log in as root" you know enough to deal with these shell issues - if you don't - don't log in as root
    – mmmmmm
    Commented Mar 27, 2015 at 12:27
  • I am sorry, but I am missing some information necessary understanding how 10 users on this machine all default to bash and root defaults to sh. What is the convention being followed?
    – DanAllen
    Commented Mar 27, 2015 at 21:24
  • Mark, I login as root to do stuff. That statement about if I don't know more about shells I should not login is root is inappropriate, unless the reason for giving the root user a different shell is to provide a competency test for the root user. That would answer my question, but that is not the reason the shell defaults to sh for root. I'd say if you don't know the reason it is like this, you should not login as root and since should not login as root, you should not be trying to answer a question about the root login. Makes as much sense as what you wrote.
    – DanAllen
    Commented Mar 27, 2015 at 21:31
  • @DanAllen, you seem to want to turn this into a debate over whether Apple should have done things the way they did. That is off-topic for this site. This site is for objective, answerable questions. The question you actually asked was "why did Apple do it this way?" and I provided about a reasonable answer to the question you actually asked. If the question you asked wasn't the question you actually wanted answered, then you might need to edit your question or to post a new question. But please see the help center. This site is for objectively answerable questions -- not general discussion.
    – D.W.
    Commented Mar 27, 2015 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .