Forget about Bash Shell, Zsh+Oh-My-Zsh is sexier!

For any developer, the terminal is THE most important daily tool. And Even if Bash and Zsh are both excellent Shells, we all have our preferences.

In my opinion, a product itself is nothing comparing to an ecosystem or a community. And this is why I love Zsh: this tool is great for my needs.

Four reasons to use Zsh over Bash:

  1. Autocorrection – try to type gir -m ‘my commit message’ in a Bash or in a Zsh to see the autocorrection in action.
  2. If you are on MacOS, your bash is old! Type a bash –version in your terminal to compare with the actual stable version 4.4.5
  3. Command completion – git and cd command completion are more powerful on Zsh than Bash.
  4. The greatest of the path replacement

Enough talk, let’s cut to the chase!

Prerequisites:

  • Internet connection
  • Homebrew
  • Admin rights

Install Zsh and Zsh-Completions

To check if you already have a version, type:

which zsh

I have already a version of Zsh on my MacOS but it isn’t the newest. So I decide to update this system-provided version using Homebrew and Zsh-Completions

brew install zsh zsh-completions

Change the default Shell to Zsh

To add or change the user database information and in particulary change the user shell, type this command:

chsh -s /usr/local/bin/zsh

Install Oh-My-Zsh

Now it’s time to get additional functionality with Oh-My-Zsh framework on top of Zsh. To do this, you will need to go back to your home directory and install Oh-My-Zsh:

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

After a restart to load the Zsh shell, you can already notice the change:

screen-shot-2017-02-24-at-21-48-07

[Optionally] Apply another theme and configure your .zshrc

Open the .zshrc file with your favorite text editor, for example

vim ~/.zshrc

and apply for example the theme ‘agnoster‘: at the line 9 (in my version), change it with:

ZSH_THEME="agnoster"

save it.

Go to Powerline-Fonts, download it, unzipped, and install it:

unzip~/Downloads/fonts-master.zip 
./fonts-master/install.sh 

To have some eye friendly colour combinations, we have to install Solarized Light and Solarized Dark themes. Go to ethanschoonover.com/solarized, under the Download section get the lastest .zip file. Then:

unzip ~/Downloads/solarized

Go under Downloads/solarized/osx-terminal.app-colors-solarized/ and with the ‘alt’ key pressed (to bypass the macOS defenses) click on the Solarized Dark ansi.terminal and Solarized Light ansi.terminal

In the terminal preferences (Settings -> Profiles), click on Solarized Dark and then the Default button.

Screen Shot 2017-02-24 at 22.40.36.png

Finally, you should see your terminal ending like:

Screen Shot 2017-02-24 at 22.55.22.png

[Optionally] Add some plugins to your Oh-My-Zsh

You also can add some plugins to simplify your daily life. In my .zshrc file, I have replaced plugins=(git) with the following:

plugins=(git colored-man colorize github brew osx zsh-syntax-highlighting sublime xcode)

Reference

https://github.com/robbyrussell/oh-my-zsh

http://ohmyz.sh/

github.com/powerline/fonts

Advertisements
Forget about Bash Shell, Zsh+Oh-My-Zsh is sexier!

One thought on “Forget about Bash Shell, Zsh+Oh-My-Zsh is sexier!

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