Homebrew Bash



This post is out of date and has been archived. Don’t say I didn’t warnyou! Gigabyte smart backup.

Bash

If you haven’t manually updated your version of Bash or Zsh on OS X, chances are it’s out-of-date. Here’s how to install the latest version and keep your shell updated using Homebrew.

Even though this is a draft, I wouldn't mind some feedback on the general approach. This PR will add functionality to automatically generate shell completion files every time a user runs brew update. At the moment, this only works for bash and isn't very intelligent. Echo 'eval $($(brew -prefix)/bin/brew shellenv)' /.profile Don't use.bashprofile because when you use something different from bash, like zsh, it may not work.profile is the correct location. Brew doctor checks the active branch for all taps, not just Homebrew/homebrew-core; brew unbottled is a new developer command to identify formulae that haven’t had binary packages built yet; brew install./ is now recommended for installing local file formulae; Bash, ZSH and Fish formula completion is now much faster with the brew formulae. Homebrew’s package index. Formerly known as: bash-completion2 Programmable completion for Bash 4.2+ https://github.com/scop/bash-completion.

OS X ships with an outdated version of Bash as its default shell. The preinstalled version dates back to 2007, and since then, Bash has been updated to add features and fix troublesome bugs. If you want to use an updated version of Bash—or even Zsh—as your shell, you can install it by using Homebrew, a package manager for OS X.

Homebrew Bash

Installing via Homebrew

Homebrew Bash Completion Not Working

To get things started, you need to tell Homebrew to install the latest version of your shell. Whether you prefer using Bash or Zsh, the following instructions will work for both. Just change the word bash to zsh, and you’ll be good to go.

Homebrew Bash

Open your terminal and enter this command:

Homebrew installs packages to /usr/local/bin/, so you’ll need to specify that path when looking for any Homebrew packages. In the following three commands, we’ll initiate a shell as the root user, append our desired shell’s path to a file of whitelisted system shells, and then change the system shell globally.

Example

Now you can close and reopen your terminal. With just those few commands, you should be using with the latest version of your shell. You can double-check the version you’re using with the command echo $BASH_VERSION. Or, if you’ve installed Zsh, you can use the command echo $ZSH_VERSION to do the same.

Homebrew Bash 4

That’s it for installing your brand-new shell. Let’s take a look at how to keep it up-to-date with the help of Homebrew.

Staying current

The Homebrew command update actually refers to updating Homebrew itself. If you want to install the latest version of a Homebrew package, you’ll have to use the word upgrade instead:

In this example, Homebrew will look for the package named bash on your computer and install the latest version. If you already have the newest version installed, Homebrew will print an error message telling you exactly that. You’ll have to run this command manually from time to time, but it’s a much more reliable approach than downloading directly from source or maintaining a cloned version control repository.

Homebrew Bash_profile

Now go out and write shell scripts for all the things.