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:
- Autocorrection – try to type gir -m ‘my commit message’ in a Bash or in a Zsh to see the autocorrection in action.
- 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
- Command completion – git and cd command completion are more powerful on Zsh than Bash.
- The greatest of the path replacement
Enough talk, let’s cut to the chase!
- Internet connection
- Admin rights
Install Zsh and Zsh-Completions
To check if you already have a version, type:
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
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:
[Optionally] Apply another theme and configure your .zshrc
Open the .zshrc file with your favorite text editor, for example
Go to Powerline-Fonts, download it, unzipped, and install it:
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:
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.
Finally, you should see your terminal ending like:
[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)