How to configure oh-my-zsh in Windows

/ 27 Views / Blog

There are 2 major ways to install oh-my-zsh in Windows: With WSL / without WSL.

Installation with WSL

WSL (Windows Subsystem for Linux) is a Windows feature that lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup.

You can use the WSL2 which is faster than v1. After the installation - you can install Ubuntu (a Linux distribution) from the Windows app store. Just follow the official guide.

I tried it for a while. You get the benefit of full Linux distribution inside Windows.

Some things to notice

  • You have 2 file systems. The subsystem files can be accessed differently via local network drive / command line. It's less convenient for me to get those files from the Linux system - instead of one single system. The paths are different.
  • You use your windows apps and install some command line packages in the Linux side. Your code is stored in the Linux environment. VSCode and Webstorm that are installed on your Windows can read/write your files from the Linux environment.
  • Every package you want to access with your Linux system's command line - should be installed on the Linux system. So this make you install tools like git, Node.js, Yarn and global packages on the Linux side too. If you want to develop sometimes on windows and sometimes on Linux - you will get some duplications.

Why I don't use WSL2 anymore

I tried to use WSL2 for a while, but then I notice a major problem: my dev server did not notice file changes. Tools like nodemon, hot-module-replacement and fast refresh did not work. It turns out that there is a open issue:

{% github %}

Some of those problems have workaround with polling instead of file watching. I try the polling approach with vite, but the experience was poor compared to vite regular fast refresh. This was BLOCKER issue for me so I removed WSL2.

Installation without WSL2

Install Cygwin

Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.

This part of the post is based on zinox9's excellent post

  • Make Sure to Let the installer install at C:\\cygwin64
  • For Download site Select Any URL , Click Add
  • STOP at packages screen, search wget expand All under Web select latest version of it under bin of wget no need to select Source. Then Continue.
  • Finish Installing and launch the Terminal. We are going to use Cygwin to Install Some Packages that will help to use Linux System on Windows. We will install apt-cyg which will work like apt-get and also install many other packages too like vim.
    • Run The following to download apt-cyg with wget. Note you can prompt to install gdb, vim or dos2unix if you want to use them or just remove them, you can install even more packages of your choice if you wish !

    wget install apt-cyg /bin apt-cyg install zsh git gdb dos2unix openssh chere vim

    - If you want your home folder to be your user's folder, you need to edit `cygwin64/etc/nsswitch.conf`. You can do this in the text editor you just downloaded, or type `explorer /etc` to open the root directory to edit the file. Add this line to the bottom: `db_home: windows`
    ### Setting Up oh-my-zsh
    - Install oh-my-zsh from it's [website](<>) or [github](<>).
    - Add plugins -
    I use 3 plugins for my dev environment:
      - git (from oh-my-zsh plugins)
      - [zsh-yarn-completions](<>)
      - [zsh-autosuggestions](<>)
    So my ~/.zshrc file looks like `plugins=(git zsh-yarn-completions zsh-autosuggestions)`
    I also add alias for open to the windows explorer

    alias open=explorer.exe

    ### Integrate with terminals
    #### Windows terminal
    Edit your `settings.json` with the following profile:
        "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44ba}",
            "defaults": {},
                    "background": "#282C34",
                    "commandline": "C:/cygwin64/bin/bash.exe /bin/xhere /bin/zsh",
                    "cursorColor": "#FFFFFF",
                    "foreground": "#DCDFE4",
                    "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44ba}",
                    "hidden": false,
                    "name": "Work",
                    "startingDirectory": "C://devl//work"


    In settings.json add the following settings:

    "": "C:\\\\Cygwin64\\\\bin\\\\bash.exe",
      "": ["/bin/xhere", "/bin/zsh"],



    C:/cygwin64/bin/bash.exe /bin/xhere /bin/zsh

    to Shell path setting


    I highly recommend using oh-my-zsh in your dev environment for better auto-completions in your terminal. Because of file watching issue with WSL2, I use Cygwin to help with the zsh installation. If you know some improvments to this setup - feel free to comment about.

    Portrait photo of me
    Nir Tamir
    © 2023 Nir Tamir