How do I make Bash 4.2 the default Terminal.app shell?

Discussion in 'macOS' started by printz, May 5, 2013.

  1. printz, May 5, 2013
    Last edited: May 5, 2013

    printz macrumors regular

    Joined:
    Dec 23, 2012
    #1
    I see that OS X is still using Bash 3.2 for its terminal emulator, which I assume it's because later versions use the more copyleft GPL v3 license. But I'd be interested to use the cutting-edge Bash 4.2 shell instead, which seems to support things like more compact input/output piping and more (as I'm reading it right now).

    I see that the Terminal.app preferences has several themes where I can set a startup command. That may work, except that Bash 4.2 (which I downloaded from MacPorts) will appear as a subprocess of Bash 3.2, the default one, and will put the window into 'dirty' status, causing it to ask me to confirm when closing it.

    Is it safe if I replace /bin/bash (the old one) with a symbolic link to /opt/local/bin/bash (the new one from MacPorts)? Or will the system become unstable?
     
  2. calderone macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #2
    Change the default shell for your user account. I would do it this way to avoid any potential issues.

    1. System Preferences
    2. Users & Groups
    3. (Unlock if necessary) Right click your account
    4. Select Advanced Options
    5. Change your login shell to point at the bash you want
     
  3. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #3
    It shouldn't be necessary to replace /bin/bash. Simply make a new command, e.g. /bin/bash4, and use that.

    Also, there should be a checkbox in each theme called "Run inside shell". Uncheck it and see what happens.

    Finally, the Terminal Preferences pane Startup has an option "Shells open with". Have you though of setting it to the new command (e.g. /bin/bash4)?

    Needless to say, you should try each of these things separately and see if it works the way you want, before moving to another one. If something doesn't work, then immediately change it back to its former value. In short, exercise ordinary programming caution: never do anything you can't immediately undo.
     
  4. printz thread starter macrumors regular

    Joined:
    Dec 23, 2012
    #4
    Yeah, that worked! Thanks :) I don't know what came into me thinking to replace system files, good thing I didn't.
     

Share This Page