Follow this simple steps to setup zsh and prezto on Mac OS X (El Capitan) and your command line will look like:


Install Zsh

Install Zsh and Zsh Completions

$ brew install zsh zsh-completions

Then try to run zsh:

$ zsh

When zsh opens for the first time, choose option 0.

OPTIONAL:

At this stage I ran into some errors similar to dyld: Library not loaded: /usr/local/lib/libgdbm.4.dylib.

Follow these steps to fix:

  • First change the ownership of /usr/local
$ cd /usr/local
$ sudo chown -R <uid>:<gid> *

Retrieve the values of <uid> and <gid> by running id in your terminal.

  • Reinstall gdbm and pcre
$ brew install gdbm
$ brew reinstall pcre

And you should be ready to go

Install Prezto

Before install

Check that you don’t already have a .zshrc file. If you do, delete it (if empty) or rename it, as this would fail the installation.

Install with

$ git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"

Create a zsh config with the files from prezto

setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done

Make Zsh the default shell

$ chsh -s $(which zsh)

If you are using iTerm, go to

Preferences > Profiles > General > Command

and put /bin/zsh --login as the Command (instead of Login Shell)

Improve the default theme

Install the Menlo Font

Download the Menlo font

Double click the font file to install it.

Set it as the default font in iTerm by going to

Preferences > Profiles > Text > Change Font

Use 14pt for the font size.

Set the theme to Solarized Dark

In iTerm, go to Preferences > Profiles > Color and in the Color Presets Dropdown, choose Solarized Dark.

Change the prezto theme to powerline

First go to your zsh command line, type prompt powerline and doublecheck that everything displays properly. This command is to preview the theme.

Then set the powerline theme as default in .zpreztorc:

Look for the line that looks like zstyle ':prezto:module:prompt' theme and replace the current theme with powerline

You should end up with:

zstyle ':prezto:module:prompt' theme 'powerline'

Now, try restarting iTerm and doublecheck that powerline is the default theme

Word jump

Let’s finish with one more tweak, word jump with alt + → and alt + ← like in a normal editor.

In iTerm, go to Preferences > Profiles > Keys and Add the following

⌥ →
Send Escape Sequence
f

and

⌥ ←
Send Escape Sequence
b

Word Delete

Do the same thing to allow the deletion of a word on alt + backspace

⌥⌫
Send Hex Code
0x17

That’s it, you are good to go. Let me know if you enjoy it and if you have awesome tweaks I should add to this list.