Fix OS X Terminal Launch Speed

Fix OS X Terminal Launch Speed

Do you have the problem where opening a new terminal window (or tab) takes 3 to 10 seconds on OS X?

We can fix that.

The delay is because bash blocks while bash_completion loads.

You think they would have fixed that by now—and they have fixed that by now.

Newer Bash versions allow delayed loading of bash_completion so you can immediately open new terminals.

If newer versions of Bash work better, why aren’t we using them? Apple refuses to ship new Bash versions because Apple refuses to ship GPL3 binaries. Check your local /bin/bash --version.

My system-provided bash is:

Yes, that’s an almost 10 year old version of Bash because Apple is afraid to ship GPL3 licensed software.

Custom Install Bash

Luckily, we’re not forever tied to system-provided bash. We can easily use homebrew to install a newer bash, a newer bash_completion, then tell our system user to use the newer shell.

Install New Bash

Install a recent version of bash (instead of the 10 year old system provided version):

Update System Shell List

Add the new bash to your system list of allowed shells.

Add /usr/local/bin/bash to the file /etc/shells

Change Your Shell

Run the shell change utility and make your shell /usr/local/bin/bash

Install Better bash_completion

Install a new bash_completion from homebrew-versions.

We need a new version because the default provided by homebrew is pinned to an old version for compatability with the system-provided 10 year old version of bash.

Note: bash-completion2 installs to a different location than regular bash-completion. Make sure you also update your bash profile to source bash-completion2 properly (homebrew will output the correct include syntax for you at the end of the install).

Now Open New Terminal

Now open new terminals and watch them become usable in less than a second instead of 5 to 10 seconds as before.

All In One Block