I don't know if this will populate in the terminal / advanced user account locations, but "The Way This Has Worked For Years"™ in Linux-land is that you must update /etc/shells
with the path to the shell location, and then use chsh -s /usr/local/bin/bash username
to use it.
Simply running chsh
without modification to /etc/shells
should cause an error indicating you've chosen an invalid shell, in case you're curious.
/etc/shells
is a root-owned file, so you must use sudo in tandem with an editor in order to modify it. I hope you're comfortable doing that, else I would highly advise against trying out a non-default shell :).
Summary (steps):
brew install bash
, then
sudo vi /etc/shells
and add /usr/local/bin/bash
to the list, then
chsh -s /usr/local/bin/bash [your_username]
and restart your terminal in order for your changes to take place
There is a better and safer way to specify which version of an executable you want your computer to use without having to modify the executables that came pre-installed on your Mac. It's generally not recommended to alter your default system tools in any way.
You can take advantage of the PATH environment variable, which allows you to list several directories that you want your Mac to search in when looking for executables.
In order to use the latest version of svn, or any other tool you installed in /usr/local/bin
with Homebrew (or MacPorts, manually, etc), you want to tell your Mac to first look in /usr/local/bin
before it looks in the default /usr/bin
. You do that by defining the PATH
in your .bash_profile
, which is a file that gets loaded automatically every time you open a new Terminal window.
You can write the PATH to your .bash_profile by running this one-liner from the Terminal:
echo 'export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"' >> ~/.bash_profile
This command takes everything between the single quotes (echo
) and adds it (>>)
to a file called .bash_profile
in your user’s root (or home) directory (~/)
.
To have these changes take effect, you can either quit and relaunch Terminal, or run this command:
source ~/.bash_profile
If you want to do it all manually, open your .bash_profile
with your favorite editor, then add this line to it:
PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
and save it. Then quit and relaunch Terminal.
Best Answer
#!/usr/bin/env bash
is the 'most portable' approach but#!/bin/bash
is the standard convention on OS X and Linux. There are advantages to shebang with a stable system interpreter, and it's probably not worth using a newer Bash.