Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Zsh / Oh-my-zsh on Windows Git Bash

Steps:

  1. Download the latest zsh package: https://packages.msys2.org/package/zsh?repo=msys&variant=x86_64

Example:

zsh-5.7.1-1-x86_64.pkg.tar.xz

Update:

The package now is compacted using zstd, so now we need some "special" extractor.
So, in my case, I've downloaded this file
https://repo.msys2.org/msys/x86_64/zsh-5.8-5-x86_64.pkg.tar.zst And extracted it using the Peazip.
https://peazip.github.io/zst-compressed-file-format.html

  1. Extract the content to your git bash installation dir:

Usually C:\Program Files\Git

  1. Test it and config zsh:

Open git bash and type:

zsh

So, this step is important, it seems zsh will ask a few configurations, like the tab completion, history, etc.
Please read the options and set that according to your use.

  1. Installing oh-my-zsh, execute the following cmd on git bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  1. Configuring zsh as default shell

Edit the ~/.bashrc file. (create it if it doesn't exist)

Add the following lines at the end of the file

# Launch Zsh
if [ -t 1 ]; then
exec zsh
fi

Close and open again the git bash.

Optional steps

  1. Installing the Honukay theme
curl -fsSL https://raw.githubusercontent.com/oskarkrawczyk/honukai-iterm/master/honukai.zsh-theme -o ~/.oh-my-zsh/custom/themes/honukai.zsh-theme
  1. Set it
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="honukai"/g' ~/.zshrc
@HaiLin545
Copy link

HaiLin545 commented Aug 2, 2022

Is any one help with this problem ? zsh on git-bash cant't user "conda activate" and "source activate",it horrible!
image

@fworks
Copy link
Author

fworks commented Aug 8, 2022

Is any one help with this problem ? zsh on git-bash cant't user "conda activate" and "source activate",it horrible! image

Hi, I think it is not a zsh thing, it is more a git-bash/windows thing.
I remember using conda before on git bash, I think you have to use the conda activate comand instead of source activate.

@Zamiell
Copy link

Zamiell commented Aug 31, 2022

https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
needs to be updated to:
https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh
(as per the ohmyzsh homepage)

@herrmartins
Copy link

herrmartins commented Sep 19, 2022

Can you give us a light on how to make spaceship theme to work? I coudln't so far....

@LionH
Copy link

LionH commented Sep 26, 2022

I noticed an issue with root directory autocompletion when I type for example "/c/use" and hit tab it won't find it, except in git bash I could get the autocompletion correctly and with capitalized folders like "/c/Users"

I have the same issue. Also it doesn't handle well Windows Path. e.g. when executing gradle wrapper, it complains about invalid java.io.tmpdir
If you try java -XshowSettings:all it shows windows path:
java.io.tmpdir = C:\Users\lione\AppData\Local\Temp\
and I suspect that a missing mintty configuration is needed here...

@pas-de-2
Copy link

pas-de-2 commented Nov 4, 2022

zsh (or oh-my-zsh, not sure which) freezees if you try resizing the console in Windows Terminal

@Armand-Lluka
Copy link

Armand-Lluka commented Nov 18, 2022

zsh (or oh-my-zsh, not sure which) freezees if you try resizing the console in Windows Terminal

Where you able to find a fix for this?

@pas-de-2
Copy link

pas-de-2 commented Nov 18, 2022

zsh (or oh-my-zsh, not sure which) freezees if you try resizing the console in Windows Terminal

Where you able to find a fix for this?

Unfortunately, no, but I also haven't put much time into tracking down the problem.

@LaurenceZanotti
Copy link

LaurenceZanotti commented Nov 26, 2022

mine also freezes unfortunately

zsh (or oh-my-zsh, not sure which) freezees if you try resizing the console in Windows Terminal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment