Every Monday, we'll show you how to do something new and simple with Apple's built-in command line application. You don't need any fancy software, or a knowledge of coding to do any of these. All you need is a keyboard to type 'em out!
A shell is the software interface to the operating system and the various services it provides. When using the default Terminal interface on an install of OS X, you are using the Bash shell. While Bash is a great shell, there are better alternatives out there, and today, we’ll show you one such alternative: Zsh.
Zsh is a better shell than the typical Bash shell that comes with OS X. The main features of Zsh is the true auto tab completion and autocorrect, but there’s also a myriad of other features, including the ability to customize your prompt.
An example is when trying to use the “killall” command in the terminal. Lets say you don’t remember the command exactly, you’re not sure if you use “kill” or “killall,” well, you can type k [tab] into the terminal to get a listing of all the possible commands that start with a “k.”
With the tab completion, you can begin to type in a command, then hit tab to automatically complete the command. If multiple commands match the text currently typed into the Terminal, then you will get a list of the possible matches. Keep tabbing to switch between the commands.
As an example, lets say that you were trying to restart the Finder by typing “killall Finder,” but you accidentally make a typo, and type “kullall Finder.” Well, Zsh is smart enough to ask if you mean to use “killall.” Pressing “y” when this prompt shows will run the corrected command again, without any further interaction on your part. If you don’t want to run it after all, press “n.”
Making typos when using the terminal is part of the issue with using a command line interface and typing all of the commands. Luckily, Zsh includes an autocorrect feature that will (for the most part) understand what it was that you were trying to say. Zsh will then ask if you wish to correct the command and go ahead running the corrected command. Pretty nifty, huh?
To install Zsh, open a new Terminal window and paste in the following code:
curl -L github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
After using this command, you will be presented with a screen that shows the download progress on Zsh. When prompted, enter your administrator password to change the shell to Zsh. Once installed properly, you will get “oh my zsh... is now installed.”
Open a new Terminal window, and you will be presented with the Zsh prompt. All of your existing commands that you’ve been using will still work the same, but the look will be slightly different, not to mention that you’ll have gained a lot of new features.
If you find out that you don’t really like Zsh and would like to return to the standard Bash shell, then just type in the following command:
If you have other problems installing or removing Zsh, refer to the documentation on the Oh My Zsh GitHub page.
Cory Bohon is a freelance technology writer, indie Mac and iOS developer, and amateur photographer. Follow this article's author on Twitter.