Oh My Zsh For Mac

  1. Oh My Zsh For Mac Installer
  2. Oh My Zsh Mac Theme
  3. Zsh
  4. Oh My Zsh Mac Install

Dec 29, 2018 Zsh, or z shell, is a popular shell alternative to bash and tcsh, complete with many improvements and customization options offered through the Oh-My-ZSH project. If you’d like to use zsh as the default shell in Terminal for Mac OS rather than bash, you can do so rather easily with taking the following steps. Today I will be sharing how to install Z Shell with oh-my-zsh and also customizing it with an Awesome Theme and Plugins to bring a pimp to your terminal. This is how the Final Setup will look like: 😎 This post is divided into 4 Parts. Setting Up Windows for ZSH installation (Cygwin & Cmder) Installing Oh-my-zsh.

The Z shell (also known as zsh) is a Unix shell that is built on top of bash(the default shell for macOS) with additional features. It's recommended to usezsh over bash. It's also highly recommended to install a framework withzsh as it makes dealing with configuration, plugins and themes a lot nicer.

We've also included an env.sh file where we store our aliases, exports, pathchanges etc. We put this in a separate file to not pollute our mainconfiguration file too much. This file is found in the bottom of this page.

Install zsh using Homebrew:

Now you should install a framework, we recommend to use Oh My Zshor Prezto. Note that you shouldpick one of them, not use both.

The configuration file for zsh is called .zshrc and lives in your homefolder (~/.zshrc).

Zsh

Oh My Zsh

Oh My Zsh is an open source,community-driven framework for managing your zsh configuration. It comeswith a bunch of features out of the box and improves your terminal experience.

Install Oh My Zsh:

The installation script should set zsh to your default shell, but if itdoesn't you can do it manually:

Configuration

The out-of-the-box configuration is usable but you probably want to customiseit to suit your needs. The Official Wikicontains a lot of useful information if you want to deep dive into what youcan do with Oh My Zsh, but we'll cover the basics here.

To apply the changes you make you need to either start new shell instanceor run:

Plugins

Add plugins to your shell by adding the name of the plugin to the pluginarray in your .zshrc.

You'll find a list of all plugins on the Oh My Zsh Wiki.Note that adding plugins can cause your shell startup time to increase.

Themes

Changing theme is as simple as changing a string in your configuration file.The default theme is robbyrussell. Just change that value to change theme,and don't forget to apply your changes.

You'll find a list of themes with screenshots on theOh My Zsh Wiki.

Prezto

Prezto is a configuration frameworkfor zsh; it enriches the command line interface environment with sanedefaults, aliases, functions, auto completion, and prompt themes.

Install Prezto:

Next create your ~/.zshrc by running:

For more information on customisation visit the GitHub repository forPrezto.

Modules

Add modules to Prezto by editing ~/.zpreztorc and adding the modules asstrings to the list:

And don't forget to apply your changes by starting a new shell instance.

Themes

To list all available themes run:

Then open up your config file (~/.zpreztorc) and change to the theme you want:

env.sh

Oh My Zsh For MacWindows

To include env.sh, open ~/.zshrc and add the following:

This file comes with some pre-defined settings, they are all optional.Please review them before you use them as your configuration. These are justexamples to show you what you can customise in your shell.

Oh my zsh for mac commands

In general, I don’t use my Mac’s Terminal app. Instead, I use iTem2 with a special configuration, that doesn’t use Bash, but Oh My Zsh as a shell, that is a framework to manage Zsh configuration as your shell. This framework allows you to install plugins or configure your prompt, among other cool things. I’ve also configured iTerm2 to work with a patched Monaco1 font with the complete collection of nerd glyphs. The result is more of less what you can see in the featured image in this post, a beautiful and elegant shell that you can configure and enjoy use.

How you can get something similar? Reach this configuration is quite easy. These are the directions:

Install iTerm2

I would begin installing iTerm2. iTerm2 is just an app similar to Terminal, but with steroids. It has far more options and even have mouse support.

To install iTerm we are going to use Homebrew:

Now that you have iTerm2 you have to install Oh My Zsh.

Install Oh My Zsh

To install Oh My Zsh you need to have installed in your system Git. Usually that is not a problem because Mac comes with its own Git, but remember that you can update to the last version easily using Homebrew.

However, you can’t install Oh My Zsh itself using Homebrew, but you can use cURL or Wget, which probably you have already installed in your system. If you don’t have any of those, you can install them through Homebrew. To install Oh My Zsh you can run the following commands:

or

Oh My Zsh has a autoupdate feature, so don’t worry about update. From time to time, it’s going to ask you to check the repo where it’s stored for updates.

Installing Powerlevel9K theme

Powerlevel9K is a Oh My Zsh external theme that gives it that awesome look and the capacity to configure the prompt, yet keep it light. There are literally dozens of themes, whether included in the Oh My Zsh repo or external ones, and Powerlevel9K is one of the external ones, so you have to download (clone the repo) and store it on the custom part for the Oh My Zsh configuration folders. To do so, just run the following command in your terminal.

Configuring Oh My Zsh & PowerLevel9K

When you have Oh My Zsh installed you can begin to configure. In order to do that you have to open the configuration file, which is located in your user folder, with your favorite text editor. In my case I like to use Atom, so I run the following command in the terminal.

Bellow you can see my configuration file. The important lines are highlighted.

As you can see I have a lot the lines commented with #, since I don’t want to use that config, but I didn’t lose them. From line 28 to 73, it’s basically the configuration of the prompt. There are literally dozens of ways to configure the prompt, and you can see some of them here. Mine is quite similar to Falkor’s one, but I’ve edited it a little bit. You can find out more about how to stylizing your prompt and how the configuration variables work here and here.

Don’t forget to set your theme as Powerlevel9k —line 33 ZSH_THEME='powerlevel9k/powerlevel9k'— and also the Powerlevel mode —line 35. The Powerlevel Mode define the type —or the style— of glyphs than are shown.

You can see also that in the lines 118 — 122 are the plugins I’m using and that in the the line 151 I establish a shortcut to access to the configuration through atom just typing zshconfig.

Configuring iTerm2

Oh My Zsh For Mac Installer

Finally, you have to configure iTerm2 to use your patched font if you want the glyphs to shown in your prompt

If you don’t want to patch any font, you can download any of the prepatched fonts, and I recommend do it using Hombrew.

Oh My Zsh Mac Theme

Finally you can configure the colors in iTerm2. Usually people use of of the presets iTerm have, or the ones you can download. But I have tweaked a little bit the colors and I have my own configuration.

Now you are ready to use iTerm2 with your new configuration.

Setting Zsh as your default shell

What is zsh mac

Zsh

First you need to check what version, if any, of Zsh you have installed.

in my case and right now my version is 5.4.2, but you can check which is the last version in the wikipedia page.

Now you have to check that you have Zsh in your list of authorized shells. You have check running opening the file /etc/shells with atom:

You have to see something similar to this.

If you don’t have the line 10, add it and save the file.

Now you run the following command to make Zsh your default shell:

Keeping Terminal with the previous config

Since I have iTerm2 with Oh My Zsh, I like to keep Terminal with Bash. Since we’ve set as a default terminal Zsh we need to set up manually to use Bash.

Open Terminal and launch the options screen Cmd + ;. In the General tap you can find which shell use terminal. Choose command and type /bin/bash.

Done, now you can enjoy the best of the two worlds. Enjoying a new, more flexible and customizable shell as default, while keeping your old one, just in case you felt nostalgic.

Oh My Zsh Mac Install

  1. I was about to upload my patched Monaco font, but then I realize that I can’t post any modification of the Monaco font since it’s copyrighted by Apple. However, you can easily patch your copy of the font for your personal use with the script provided by Nerd Fonts. I faced some problems when I tried to patch it myself, basically related to the height of the patched font, which ended up different than the original font. If this is your case, you can just download FontForge —brew cask install fontforge— and modify those parameters to be equal to the original ones ↩