zsh Shell HowTo

I would say that as being new to mac, I found zsh shell is one of the best and I am digging more about it every day.  I thought this article would be helpful for someone who is in need of a great terminal application.  The zsh shell comes with lots of themes to beautify the static terminal. I use iTerm2 on my mac and using zsh with it, the combination made in heaven.

Screen Shot 2013-08-25 at 10.20.30 PM

I use brew on my mac (as application installer) so using brew to install zsh shell on mac is the best option however it will only work if the zsh package is available through brew installer. If you don’t have brew on your mac you can install just by visiting the site below and follow the instructions:

http://brew.sh/

To check if any application or package is available on through brew you can try:

$ brew search <package_name> 

$ brew search zsh 

zsh
zsh-completions
zsh-lovers
zsh-syntax-highlighting
zshdb

As we can see above the zsh package is available so we can get more info about it as below:

$ brew info <package_name>

$ brew info zsh

zsh: stable 5.0.2

http://www.zsh.org/
/usr/local/Cellar/zsh/5.0.2 (1053 files, 8.7M) *
Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/zsh.rb
==> Dependencies
Required: gdbm, pcre
==> Options
–disable-etcdir
Disable the reading of Zsh rc files in /etc
==> Caveats
To use this build of Zsh as your login shell, add it to /etc/shells.

If you have administrator privileges, you must fix an Apple miss
configuration in Mac OS X 10.7 Lion by renaming /etc/zshenv to
/etc/zprofile, or Zsh will have the wrong PATH when executed
non-interactively by scripts.

Alternatively, install Zsh with /etc disabled:
brew install –disable-etcdir zsh

Add the following to your zshrc to access the online help:
unalias run-help
autoload run-help
HELPDIR=/usr/local/share/zsh/helpfiles

To install zsh  shell you can just in

$ brew install <package_name>

$ brew install zsh

You can make sure installation is completed and zsh is installed:

/bin/zsh
/Users/hadoopworld/Library/Logs/Homebrew/zsh
/usr/lib/zsh
/usr/lib/zsh/4.3.11/zsh
/usr/local/bin/zsh
/usr/local/Cellar/zsh
/usr/local/Cellar/zsh/5.0.2/bin/zsh
/usr/local/Cellar/zsh/5.0.2/lib/zsh
/usr/local/Cellar/zsh/5.0.2/share/zsh
/usr/local/lib/zsh
/usr/local/Library/LinkedKegs/zsh
/usr/local/opt/zsh
/usr/local/share/zsh
/usr/share/zsh

 After the installation is completed you would need to download the config files which you can download directly from zsh git repo by cloning the repo to a specific folder. In the command below I am cloning zsh to my work folder, in its own folder name .oh-my-zsh.

 $ git clone https://github.com/robbyrussell/oh-my-zsh.git ~/work/.oh-my-zsh

After clonOnce cloning is done you can change the shell for a specific using in your mac using chsh command used as below:

$ sudo chsh <desired_shell_binary> <user_name>

$ sudo chsh /usr/local/bin/zsh my_user_name

Now the last step to configure the zsh shell as you desired. First you would need to make sure that zsh shell resource configuration file is located in user home folder name .zshrc as below:

$ ls -lah ~/.zshrc

Next edit the .zshrc file to reflect the correct .oh-my-zsh location as below (In your case choose the correct folder where you have cloned the zsh shell config):

$ vi ~/.zshrc

Edit the path for correctness

# Path to your oh-my-zsh configuration.
ZSH=$HOME/work/.oh-my-zsh

You can also edit your choice of the these as below:

ZSH_THEME=”jonathan” ## “robbyrussell”

Finally source the shell to reflect the changes as below:

$ source ~/.zshrc

Thats all. You have zsh shell working with your terminal.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s