I set /bin/bash as my default shell like this:

chsh -s /bin/bash

But it doesn't work when I open a new terminal tab. If you type any command, e.g. ls, no output is printed.

Likewise if I simply run /bin/bash from a working shell it behaves the same way.

My current shell is /bin/sh.

I'm trying to change my shell to bash because the current shell (/bin/sh) doesn't execute neither ~/.bashrc nor ~/.bash_profile for some reason, although it appears to be bash too:

$ /bin/sh --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc

I used to use zsh together with oh-my-zsh but it was unacceptably slow, so I'm switching back.

I used bash before that. Both of those files I mentioned were executing at that time (I didn't change the configuration).

  • what happens if you use /bin/ls ? – fd0 Oct 26 '16 at 10:30
  • @fd0 Nothing, same as if I run ls. – iosdude Oct 26 '16 at 10:32

I have found the culprit:

if [ -f $(brew --prefix)/etc/bash_completion ]; then
  source $(brew --prefix)/etc/bash_completion

These lines in my ~/.bashrc were causing bash to hang up on startup and it wasn't executing any commands as a result. Commenting them out solved the issue.

Apparently, there is some error in that script (it's part of Homebrew's bash-completion package).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.