Setting up Zsh and oh-my-zsh on Windows via Git Bash

Set up Git on Windows

To set up Git Bash on Windows, follow these steps:

  1. Download the Git for Windows installer from the official website.
  2. Run the installer and select the desired components. Make sure the "Git Bash" option is selected.
  3. Follow the rest of the installer prompts to complete the installation.

Once Git Bash is installed, you can access it by right-clicking in a folder and selecting "Git Bash Here" from the context menu. This will open a Git Bash terminal window in that folder.

Set up Zsh on Git Bash

To set up Zsh on Git Bash, follow these steps:

  1. Download the latest Zsh package from the MSYS2 package repository. The file will be named something like "zsh-5.8-5-x86_64.pkg.tar.zst".
  2. Install an extractor that can open TAR and ZST archives, such as 7-Zip and facebook/zstd (named something like "zstd-v1.5.2-win64.zip"). First, use zstd to extract the TAR file. Later, use 7-Zip to extract the files into the Git Bash directory.
bashCopy code
# Open Git Bash
# Navigate to the zstd file
$ cd ~/../zstd-v1.5.4-win64

# Decompress the .zst file
$ ./zstd --decompress ~/Downloads/zsh-5.8-5-x86_64.pkg.tar.zst

# The TAR file will be created in the ~/Downloads/ directory
$ ls ~/Downloads/ | grep .tar
  1. Extract the archive's files using 7-Zip (which should include etc and usr folders) into your Git Bash installation directory. This directory is usually located at "C:\Program Files\Git". If asked, merge the contents of the folder (no files should be overwritten).
  2. Open Git Bash and test Zsh.
bashCopy code
# Testing Zsh
$ zsh

IMPORTANT: Configure tab completion and history in Zsh using the first-use wizard. If, for some reason, it doesn't appear, or you skipped it, re-run it:

bashCopy code
autoload -U zsh-newuser-install
zsh-newuser-install -f
  1. Configure Zsh as the default command-line shell.
bashCopy code
# Create/edit the ~/.bashrc file
$ notepad ~/.bashrc
  1. Add the following content to the file: