Windows – How to install and use ZSH with Ubuntu shell on Windows 10

bashshellUbuntuwindows 10zsh

What voodoo must one employ to correctly install and use ZSH on the Ubuntu shell in Windows 10?

These instructions have completely failed me. I have successfully installed ZSH using sudo apt-get install zsh. I then ran sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" as recommended here. This loads up what seems like ZSH however, whenever I change the theme, it doesn't seem to change and if I close my session, it reverts back to BASH.

No amount of changing the shell using commands similar to chsh -s $(which zsh) seem to work as echo $SHELL always seems to return /bin/bash. I have tried restarting the Ubuntu shell, restarting my computer, spending a few days away from the Ubuntu shell to see if it fixes itself but no – nothing. I am at a complete loss. I don't know where to look or what to check or how to get it to work. Would very much appreciate if someone could please save me from pulling out my hair and enlighten me. Meanwhile, I will try some yoga.

Thanks,

Mo.

Best Answer

If using BASH on Windows 10, add the following to your .bashrc file to ensure ZSH is launched whenever you open BASH.

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

Source: @Hex, https://github.com/Microsoft/BashOnWindows/issues/846, http://www.howtogeek.com/258518/how-to-use-zsh-or-another-shell-in-windows-10/

Related Question