Blog

Switching from bash to zsh in OS X

I recently switched shells from bash to zsh after noticing many of my coworkers using zsh and finding myself with a bit of ‘shell envy’. The aliases, code completions and customizations that can be made in zsh make it quite appealing. I checked out and tried a couple of different frameworks for zsh customization, oh-my-zsh and zshuery.

While oh-my-zsh seems to have many more users (3350 watchers and 1340 forks) as compared to zshuery’s (14 watchers and 4 forks), I really liked the minimalism and simplicity of zshuery. If you have a few minutes to spare you should give it a try. Follow along below…

Check out the framework into your home directory. (FYI, the –recursive flag will clone the zsh-completions git submodule contained within.)

git clone --recursive https://github.com/myfreeweb/zshuery.git ~/.zshuery

If you already have a ~/.zshrc file, you should back it up in case you want to revert.

cp ~/.zshrc ~/.zshrc.orig

Copy the contents of the ‘Example zshrc’ from the bottom zshuery readme into ~/.zshrc Open a terminal, switch to zsh (if not already) and source/reload the .zshrc file.

zsh
source .zshrc

You should now be up and running with the default settings, but you may want to do a bit more tweaking and personalization. For example, you will want to duplicate any PATH settings, etc from your previous shell. These can simply be appended to the end of your new .zshrc file. If you are a ruby h4xx0r, don’t forget to copy/paste your RVM or RBENV init codez as well. Custom aliases may be best suited for placement directly in ‘zshuery.sh’. Have a look around in the project for further possibilities; it is actually quite readable.

If you are smitten like me, and wish to make zsh your new default shell, use the following command.

chsh -s $(which zsh)

You may also want to check out the following resources.