How to install and run (Oh-My-) zsh on Windows

I run zsh on Windows. But why? Some time ago, when I was still using a Mac, one of my colleagues suggested to use zsh instead of bash.

Since then I switched to a Surface Book which I happily preferred over OS X mac OS and mainly use cmdr as my shell. Now the Windows 10 Anniversary update is out, and it comes with "Bash on Ubuntu on Windows".

Now, while having bash on my fingertips again, my colleagues' suggestion came back to my mind, and I tried to use zsh again.

Installation of zsh on Windows

Installation of zsh on Bash on Ubuntu on Windows is as easy as installing it on plain Ubuntu. You start bash and issue the following command:

sudo apt-get install zsh

This will use the default package manager apt of the Ubuntu that runs on the Linux Subsystem on Windows to install the zsh package.

You can directly try it out by simply calling zsh from your shell to open a new zsh from Bash.

Making zsh on Windows your default shell

I wanted zsh to start directly when I open Bash on Ubuntu on Windows, because I am too lazy to always launch it manually. To do so, I added the following little snippet at the very beginning of the ~/.bashrc file:

# if running in terminal...
if test -t 1; then
# ...start zsh
exec zsh

See it here in context:

Image of changes in .bashrc in context
Changes in .bashrc file

When Bash starts up, it will check if it has a terminal attached to stdout (the test -t 1 part) and then it executes zsh. You should try it out directly by quitting Bash and restarting Bash on Ubuntu on Windows and see how it launches zsh directly.


A plain zsh is quite boring, and there are a ton of useful things for zsh to leverage, so customization is key. A well-known repository of zsh customizations with nice defaults is Oh-My-Zsh, and it brings a cornucopia of themes, plugins and features with it. Installation is fairly easy, again. From your freshly installed and started zsh, you just issue the command that is shown at the oh-my-zsh website:

sh -c "$(curl -fsSL"

After that, you can configure your plugins (I use git and ubuntu) and themes (I use this custom one).

Update 2016/11/16: Be aware that this theme also requires 'git' to be installed to display branch information, so you should do a sudo apt-get install git if you did not already.

Zsh is a bit theme-happy, so you will find more than 100 of them in the default installation. To help a bit, there are some screenshots shown in the zsh wiki. Please be aware that unicode characters in zsh in Bash on Ubuntu on Windows aren't really supported by now, so some themes may not be for you.

So, after a bit of customization, you can start to enjoy the features of zsh.

An example of globbing, in zsh on Bash on Ubuntu on Windows
An example of globbing, in zsh on Bash on Ubuntu on Windows

Further reading

If you are more interested in Mac and OS X mac OS, here is a great post from one of my co-workers: Thorsten Hans: Setting up iterm2 with oh-my-zsh and powerline on OS X.

Also a great post on the features of zsh (including globbing!) is this one: David Fendrich: No, Really. Use Zsh.

And if you already seek for a far more deeper experience, then you can dive into this: Jerome Dalbert: Migrate from oh-my-zsh to prezto.

Update 2016/11/16:

Fixed in article: OS X is now mac OS.

In response to Michals question (thanks!), I blogged about how you can run Bash (or Zsh) in you can run Bash (or Zsh) in Cmder

6 Replies to “How to install and run (Oh-My-) zsh on Windows”

  1. Hi sgingter, thank You for the awesome article.

    I also installed oh-my-zsh on windows.
    However, do You know how can I run it as a new console tab in cmder? I am used to it, but cannot make it work, I cannot even run bash on it.


    1. Hi Michal,

      I’m afraid that is not possible.
      Cmder is a console emulator for Windows, and will only run the normal Windows command shell (cmd.exe) in an environment that resembles (or emulates) how a console would work on *NIX systems.

      Bash on Ubuntu on Windows however is the real Ubuntu Bash, running in a real Ubuntu installation that runs run on the Linux Subsystem for Windows (which just intercepts the kernel calls from linux and translates them to the Windows Kernel).
      There is no cmd.exe, it’s just a real linux bash. And you can use that to run a real linux Zsh-

      However, that has nothing to do with Cmder, as Cmder is a Windows program and not a Linux program.

    2. Hi Michal,

      I just figured out, that it is, in fact, possible to run bash (or zsh 😉 ) in Cmder.

      Just create a new TASK in Cmdr (Shortcut: Win + Alt + T).
      For the new Task, you can set the bash icon in the task parameters: -icon "%USERPROFILE%\AppData\Local\lxss\bash.ico"
      Then, in the commands windows, enter the following:
      %windir%\system32\bash.exe ~ -cur_console:p

      If you want ZSH to startup directory, then use this command: %windir%\system32\bash.exe ~ -c zsh -cur_console:p

      1. it is possible to use zsh and don’t lose scroll bars in terminal? I only can do this if I’m using zsh in Terminator (which requires VcXsrv)

  2. This was very helpful! I appreciate that you took the time to publish this!

Comments are closed.