Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

As a follow up to my previous question, I reinstalled my MacPorts and want to try its newer version of bash again.

I installed the newest bash via MacPorts on my Mac OS X 10.6.8 system, but when I start a Terminal.app session, the "sh --version" command showed I was still using the old bash 3.2.48. This is even when "which bash" points to the newer 4.2.37 installed by MacPorts.

I tried to change Terminal.app preferences to use the new bash as default, changed /etc/shells, and used the chsh command to specify MacPorts bash as the default. However, none of these methods were successful. What am I missing? Thank you very much.

share|improve this question
1  
So you broke the shell once already, and you want to see how to do it again? The reason which bash shows the newer shell but you're running the older one is that the shell is launched by absolute path (/bin/bash) and doesn't obey the path. Which wouldn't matter anyway, since the path isn't set to include MacPorts until .bashrc is run. –  Alan Shutko Oct 31 '12 at 3:23
add comment

1 Answer

up vote 4 down vote accepted

sh --version is probably the same as /bin/sh --version. If the current shell is bash, you can see its version with echo $BASH_VERSION. If you change the default login shell with chsh, you can keep Terminal's default shell as the login shell.

  1. sudo port install bash
  2. Add /opt/local/bin/bash to /etc/shells
  3. chsh -s /opt/local/bin/bash
  4. Open a new tab and check echo $BASH_VERSION
share|improve this answer
    
Worked just as described. Thank you! –  hpy Oct 31 '12 at 19:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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