I have patched bash & sh with the latest patches as described here, but now have some issues with some things in my dotfiles (particularly the loading of rvm and some custom functions and completions).

I don't have the issues if I just use the brew version of bash as both /bin/bash and /bin/sh, but I'm wondering if I might run into other problems with system stuff.

up vote 5 down vote accepted

I would advise against making the Homebrew installation of bash your system-wide bash or sh command. However it should be fine to use as your personal shell.

Homebrew provides a vanilla installation of Gnu Bash. You will be missing any Apple additions to the shell that are provided if you use the Apple-supplied bash or sh binaries or source code from Apple's opensource.apple.com site. Any OS-level shell script provided by Apple may be relying on those Apple extension and changes to function.

Homebrew also installs, by default, a 4.3.x version of bash:

> brew info bash
bash: stable 4.3.24 (bottled), HEAD
http://www.gnu.org/software/bash/
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/bash.rb
==> Dependencies
Required: readline ✘
==> Caveats
In order to use this build of bash as your login shell,
it must be added to /etc/shells.

This is a significantly different version than the 3.2.x version that ships with OS X 10.9.x. It is not 100% backwards compatible with pre 4 versions. For example substring extraction on positional parameters indexing changed from 3 to 4. It could break system-level scripts.

Both of those reasons can lead to inoperable system scripts on your Mac if you switch to Homebrew's versions of bash and sh for anything other than your personal shell. You can make your personal shell the Homebrew bash shell by running:

chsh -s /usr/local/bin/bash

and then logging out and logging back in. This should be relatively safe for the stable operation of your machine.

If the above chsh command fails saying /usr/local/bin/bash is not an acceptable shell you'll need to add it to the list in /etc/shells by running:

sudo vim /etc/shells

It should be added on a new line in the file like so:

> cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/zsh
/usr/local/bin/bash

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.