You are here

Update shell to ZSH on OSX & UNIX

zsh shell with solarized dark & dogenpunk theme

((( This is for *NIX users - so OS X or Linux. If you're on Windows, check out: http://zsh-nt.sourceforge.net )))

Today we will be upgrading (re: changing) our shell from bash to zsh!

More on zsh here: http://zsh.sourceforge.net/FAQ/zshfaq01.html#l3

Why do you need it? Well, you don't technically... but I HIGHLY recommend it.

We will be using a package called 'oh my zsh!' from https://github.com/robbyrussell/oh-my-zsh

1. If you don't have it already, install ZSH. This comes with OSX but you might need to download it on other forms of UNIX.

$ apt-get install zsh

2. Install Oh My ZSH! - there are two ways to do this...

-- via `curl`

$ curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

-- via `wget`

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

--Note: only one of these lines is necessary - it depends on your system. On OSX I used the curl method.

3. The package installer will run and you may be prompted to answer 'yes' to a few questions.

4. Once oh my zsh is installed, you should close your current CLI (CMD+Q on Mac)

5. Re-open your CLI of choice and now you are using ZSH!

6. You can configure zsh through your .zshrc file

$  vim ~/.zshrc</pre>

It should look something like this:

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
 
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
 
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)
 
source $ZSH/oh-my-zsh.sh
 
# Customize to your needs...
export PATH=/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

I am not a big fan of the auto-correct that comes with oh-my-zsh so I turned that off adding this to my .zshrc:

unsetopt correct_all

There are a number of oh-my-zsh themes here: https://github.com/robbyrussell/oh-my-zsh/wiki/themes

Just change the string ZSH_THEME="robbyrussell" to ZSH_THEME="newthemename"

You must exit your CLI and re-open it to see the new theme.

Enjoy!

Submitted by brant on Thu, 05/10/2012 - 11:39