Affiliate: Claritee your landing page before building it!

Please note that this installation is not with WSL (Windows Subsystem for Linux). I always use terminal from VS Code so I don't need to change windows (alt + tab) every time I need to do a command task.

Steps:

  1. ZSH on Windows installation, that require us to:
    1. Install Cygwin on Windows
    2. Set Up ZSH as the default terminal for windows
  2. Set up ZSH as the default terminal for VS Code
  3. Install oh-my-zsh for ZSH on Windows

1. ZSH on Windows installation

First, download the Cygwin installer based on your Windows system (32bit or 64bit). Then run it to install on your Windows.

In the installation process, you should make sure that the installation folder is c:\\cygwin64.

When select packages screen prompted, you should find wget by typing directly on the search input form or change to: change to category view → expand (+) all → expand (+) web → find wget → from the new column, select the latest version → next.

After the Cygwin installation is finished, next we are going to set up Windows Terminal to use Cygwin bash as the default Windows Terminal.

To do so, you have to open the setting.json of your Windows Terminal. Or open it from the setting screen.

{
// the rest configuration goes above...
  "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44ba}",
  "profiles": {
    "defaults": {
      
    },
    "list": [
      {
        "commandline": "powershell.exe",
        "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
        "hidden": false,
        "name": "Windows PowerShell"
      },
      {
        "commandline": "C:/cygwin64/bin/bash.exe /bin/xhere /bin/zsh",
        "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44ba}",
        "hidden": false,
        "name": "Cygwin ZSH"
      },
// the rest configuration goes below...
    ]
  },
  
}

If you reopen the terminal, you should now be using bash from Cygwin. You can check by running the command echo $SHELL to see what current is the command line.

Next, we will then use wget to install apt-cyg.  Then use this apt-cyg to install zsh to the Cygwin.

To do so, on the terminal, run these commands:

wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
apt-cyg install zsh git gdb dos2unix openssh chere vim

Relaunch the terminal, then try to check the version of the ZSH by run command zsh --version, the version should be show.

We are done installing Cygwin and ZSH on Window Terminal. Let's make the ZSH to be the default terminal for VS Code.

2. Set up ZSH as the default terminal for VS Code

As I said earlier, I do this step because I enjoy run command from VS Code. If you don't want, you can just skip this part and move to the oh-my-zsh installation step.

2.1 Cygwin Terminal Profile Integration

First, open setting.json of your VS Code. Locate the terminal.integrated.profiles.windows then add the Cygwin terminal profile code inside it. and to make the Cygwin as the default terminal, add the "Cygwin" as the value for terminal.integrated.defaultProfile.windows.

So the code should be like this:

 {
 
 //the rest setting.json code goes above..
 
  "terminal.integrated.defaultProfile.windows": "Cygwin",
  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell"
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-cmd"
    },
    "Git Bash": {
      "source": "Git Bash"
    },
    "Cygwin": {
      "path": "C:\\cygwin64\\bin\\bash.exe",
      "args": [
        "--login",
        "-c",
        "zsh"
      ]
    }
  }
}

2.2 Add VS Code Plugin into Cygwin

To add the VS Code plugin, you open the .zshrc file that is located in your Cygwin user folder, ex: c:\cygwin64\home\[your profile].

Scroll and find plugins, add vscode inside it. ex: plugins=(... vscode). Save it and relaunch the VS Code Terminal.

To check, kill any running terminal on VS Code then reopen it. Run command echo $SHELL or zsh --version like before.

We have the ZSH as the default terminal, the last is to install oh-my-zsh.

3. Install oh-my-zsh for ZSH on Windows

Go to the oh-my-zsh homepage to learn more about it. As you can see on their documentations, the installation is straightforward via wget.

You can just run the following command:

sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

Wait the installation completed then you can relaunch the Terminal and oh-my-zsh should be there now.

Let me know your thought or you find a mistake/outdated content for this post.

Get the latest update of tutorials, inspirations and useful resources for website design and development to your email box