Zsh: Oh Myyyyyyyyyy

YOU. NEED. ZSH. That’s basically the gist of the information out there about it. Zsh is praised in virtually all media to the very highest heavens. That last link, “Things I Use: Zsh” was the most convincing (Go ahead, read it!), so I figured I had nothing to lose.

– It detects typos and asks politely “Did you mean…?”
– It autocompletes like a dream.
– No seriously, we’re talking context-pattern awesomeness. Based on the task you’re doing, Zsh will autocomplete the exact relevant command you’re about to type when you press TAB. So “rake g__” while I’m in my octopress folder will autocomplete to “rake generate”.
– Shares its command history, useful for tricky or convoluted commands you can only remember part of
– Global aliases – meaning, create nicknames for your commands!

Not convinced? Make your terminal behave like Emacs or Vi

I know, you’re thinking that Bash already does alot of these things. Well, it doesn’t. Not to the sophisticated extent of Zsh. If you don’t care about Zsh and want your terminal to function like emacs, use Bash’s Emacs mode: set -o emacs. This is helpful because sometimes I want to make sure my Vi comfort level is up to date, and I can set Bash to Vi style command line editing with set -o vi. If you tend to spend alot of time in the terminal, its another very helpful and efficient way to practice your text editor skills.

Good news for Mac Users

Your OS X Validation is here! Zsh is already preinstalled in a Mac. You can just type chsh -s /bin/zsh to make it your default in the terminal. Then go on your merry way with ZShell. For the rest of us, continue onward…

Oh My Zsh. The good and the bad

Here is a step by step version of what worked for me.
Step 1. sudo apt-get update && sudo apt-get install zsh

Step 2. wget –no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O – | sh

Step 3. chsh -s /bin/zsh

If you want Oh-My-Zsh which is Zsh dressed up with tons of helpful plugins, functions, and themes, then I strongly recommend you follow the instructinons at its Github page.

Both Oh-My-Zsh and Zsh instrutions end with the same command. You are told to change the shell source (or default) with: chsh -s /bin/zsh. After entering this in your terminal, the instructions on virtually every blog say to simply open a new terminal. Nope. You have to restart your whole darn computer for Zsh to take effect.

Alls well?

Everything was going beautifully with Zsh, until I wanted to rake generate this octopress blog. Zsh had a royal hissy fit about it. I got this error: ERROR: Could not find rake-0.9.6 in any of the sources
Run bundle install to install missing gems There are a few sources on dealing with Zsh and Ruby, particularly Zsh and Octopress. But they all said the same thing: add alias rake="noglob rake" to your .zshrc file and go on with your life.


First, copy the .rvm related lines from your bash_profile. For me it was: [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm
Delete the path that was listed in your .zshrc file (its like your .emacs file), and add the lines from the .rvm in there. This is what sets up the correct configuration.

Finally, enter this command into your terminal: cat ~/.bash_profile >> ~/.zshrc
And with that….. Octopress + Zsh can live together in peace.

Link 1Link 2