DEV Community

Cover image for Installing ZSH on Windows

Installing ZSH on Windows

Arjun Porwal on March 21, 2020

Welcome Everyone All of us have seen customizable and feature-full terminals in linux and mac, if you want to have a cool looking &...
Collapse
 
mburszley profile image
Maximilian Burszley • Edited

I'm uncertain why you'd go through the trouble of using cygwin/cmder when you can use WSL2+Terminal and have a native experience.

Collapse
 
zinox9 profile image
Arjun Porwal • Edited

Let me help you through this , I have specific reasons for not using WSL
Reason 1 - I will have to install Full linux shell in my windows
Reason 2 - The setup and usage of WSL was not easy to understand
Conclusion I simply preferred this way , cause I found it easier and I didn't have to install full linux shell in windows for just oh-my-zsh. Though If anyone does want a full native experience they can prefer WSL way too.

Collapse
 
mburszley profile image
Maximilian Burszley

Let me help you through this

I don't know if English is your first language, but that phrase is extremely condescending.

Reason 1 - I will have to install Full linux shell in my windows

You're already doing that with Cygwin.

Reason 2 - The setup and usage of WSL was not easy to understand

It's a Windows feature and then you install a distro through the Store. You're doing way more work in your post than what it takes to get it set up otherwise.

Thread Thread
 
zinox9 profile image
Arjun Porwal • Edited

I didn't mean the phrase that way, its all cool.
Ohkay so , with the help of Cygwin I am just installing apt-cyg , to install zsh & git that's all. The other packages are user's choice. But For WSL I have to go to windows store and install Full Ubuntu Shell Package .
Yes WSL is a windows feature, and some people might find it easier to set it up for their usage, I agree with that. It's just a matter of choice , for me it was easier to Find and Do it this way , and just shared it with others.
As I said Before, If anyone wants they can prefer going WSL way, this way isn't a compulsory.
Though thanks for listing this other way too here, it can help many more people 😊🤘

Collapse
 
hawtre profile image
hawtre

What do you mean by full Linux shell? You'd have to install zsh regardless, no?

Thread Thread
 
zinox9 profile image
Arjun Porwal • Edited

By Full Linux Shell I mean that , for the WSL way I will have to install Full Ubuntu Package (or whichever distro you prefer) just to use ZSH, in this way I am just installing apt-cyg package and then zsh that's it.
It's as simple as that and a matter of choice for the user, not a compulsory to go my way only. Just sharing what I found.

Collapse
 
jckodel profile image
J.C.Ködel • Edited

Working fine on Windows Terminal and VSCode, with some issues:

1) Flutter script only recognize MINGW, so you need to set an alias in your .zshrc: alias dart="/cygdrive/c/flutter/bin/dart.bat" and alias flutter="/cygdrive/c/flutter/bin/flutter.bat".

2) Git from cygwin doesn't work on flutter, so either don't install it or install git for windows and then delete (or rename) \cygwin\bin\git.exe

3) For Windows Terminal, open settings and change your prompt settings to "commandline": "zsh --login -i" (the default profile is {0caa0dad-35be-5f56-a8ff-afceeeaa6101})

4) For VSCode, configure your terminal to cygwin: "terminal.integrated.shell.windows": "C:\\cygwin64\\Cygwin.bat",, then edit that batch file to set zsh as the default shell: cd /d "%~dp0bin" && zsh --login -i

And that's it... zsh working fine on both Windows Terminal and VSCode, without that trashy WSL.

Collapse
 
deanzsh profile image
Deandra Lisel

how did you do it?

Collapse
 
zinox9 profile image
Arjun Porwal

That's Great ! Thanks for the extra tips.

Collapse
 
muhimen123 profile image
Muhimen

Hey, it's giving no result for wget. what shall I do?

Collapse
 
zinox9 profile image
Arjun Porwal

Let me List some things that you might have missed :

  1. During installation the server that you selected , try another one.
  2. In the search check your spelling (reference to the snapshot I Provided)
  3. If there are any dropdowns visible try opening them and finding wget. Hope any of these helps. If it doesn't you can attach any of the Snapshot of your screen for me to help you more.
Collapse
 
muhimen123 profile image
Muhimen

Thanks bro. I just fixed it.

Thread Thread
 
zinox9 profile image
Arjun Porwal

Awesome ! 🤘

Collapse
 
deeplobo profile image
Deeplobo

r a sokha....

Collapse
 
ajinkyax profile image
Ajinkya Borade

thanks for this great article. But sadly after doing the zsh install step and quiting the cygwin terminal. When I reopen, there is no difference. no ZSH !

screenshot

Collapse
 
olegkhodakivskyi profile image
OlegKhodakivskyi • Edited

Hi.
After commands
install apt-cyg /bin
and
apt-cyg install zsh git gdb dos2unix openssh vim

  • nothing happends, its should be like that?
Collapse
 
zinox9 profile image
Arjun Porwal

maybe waiting for sometime would have made it work , or else you can try the next steps and see if the commands worked properly. If the commands didn't work then you will not see the screen in cmder as I did. Good luck

Collapse
 
olegkhodakivskyi profile image
OlegKhodakivskyi

Ok, I got an issue. After this step: "Do the same for Admin Privileges , rename it as {cygwin:ZSH as Admin} and replace command with:...". I launch Cmder again, it's starting mintty.exe but after gave error: "/usr/bin/zsh: Exit 126.
Failed to run '/usr/bin/zsh': No such file or directory".
zsh folder was not in archive so I created one, but error still pop out. Any suggetions or info about it?

Thread Thread
 
zinox9 profile image
Arjun Porwal

Yeah so now its confirmed that the commands
install apt-cyg /bin
and
apt-cyg install zsh git gdb dos2unix openssh vim

did not work properly , that's why zsh is not installed yet. I think you can try to remove everything and follow the steps again. Maybe you missed a step that would have caused this problem.

Collapse
 
alexanderkhudoev profile image
Alexander Khudoev

Hey, Arjun! How I can implement this (zsh + cmder) Terminal as default PhpStorm Terminal? I'm trying to set up command: "cmd.exe" /k ""C:\cmder\Cmder.exe""
but it opens in separate window (not inside the PhpStorm terminal)..

Collapse
 
overrevvv profile image
Arnav • Edited

Thank you for this great article and even comments on this article are very helpful.

I have a question and its kinda not relevant to this article, I've got both git and WSL set up, but the big issue with WSL is, that its not able to access the reasources that i already have on my windows for example node, python, java and so on.

But i do wanted to experience the Z-Shell without hassle of WSL and this article helped me a lot,

My question is-:
Is there a way to set up an alias command for git-bash and invoke from any directory when needed via powershell so i can use zsh directly in that directory when needed?

Sounds dumb but i want powershell to be default but i also want to set up git in a way that it can access git-bash and Z-shell from anywhere like we can do with cmd (whenever we type cmd it start working directly into powershell).

Image description

basically what i want to achieve is when i type "gsh" git bash opens up in the way cmd does when used via pwsh.

UPDATE: I found the solution on stack overflow again thanks for this article.

Collapse
 
ngotienthien profile image
ngotienthien

how i change start directory when i open in contextmeu

Collapse
 
zinox9 profile image
Arjun Porwal

tried my best , but could not find a working way 😅

Collapse
 
paras594 profile image
Paras 🧙‍♂️

great post !!! 👏👏👏🎉🎉

Collapse
 
zinox9 profile image
Arjun Porwal

Thanks !

Collapse
 
nvlinh99 profile image
Linh Nguyen Vu

How to set Cmder to default terminal of VSCode bro ?

Collapse
 
zinox9 profile image
Arjun Porwal

You can do it in VSCode using these commands in settings.json

   "terminal.integrated.shell.windows": "C:\\Users\\Username\\Cmder\\Cmder.exe",
   "terminal.external.windowsExec": "C:\\Users\\Username\Cmder\\Cmder.exe",
Enter fullscreen mode Exit fullscreen mode

replace the path to cmder with yours ,
even if you set it , it wont run as inbuilt terminal in VSCode , it is only possible to launch it externally.

Collapse
 
nvlinh99 profile image
Linh Nguyen Vu

Thanks bro.

Thread Thread
 
fl4zher profile image
Harun Kilic • Edited

It is actually possible with those lines in settings.json in VScode:

    "terminal.external.windowsExec": "C:\\Cmder\\Cmder.exe",
    "terminal.integrated.shell.windows":   "C:\\Cygwin64\\bin\\bash.exe",
    "terminal.integrated.shellArgs.windows": ["-lic", "cd $OLDPWD; exec zsh"]
Collapse
 
callmejaja profile image
Reza Asriano Maulana

I'm still confused at the step "Do the same for Admin Privileges , rename it as {cygwin:ZSH as Admin} and replace command with
*C:\cygwin64\bin\mintty.exe /usr/bin/zsh --login -i -new_console:d:%USERPROFILE%"

Please help me

Collapse
 
nikosdev profile image
Nikos Kanakis

I will definetely try it !!!

Collapse
 
zinox9 profile image
Arjun Porwal

Hope You find it Awesome and Easy ! 🤘

Collapse
 
sagspot profile image
Oliver Sagala

When I type something on my terminal, I get random ←[?1h←[?1h caused by zsh-autosuggestions.

How do I solve this?

Collapse
 
keerikadan03 profile image
Keerikadan03

the link for cmder is wrong
cmder.app/

this is the right link

Collapse
 
deeplobo profile image
Deeplobo

bal, baichhha thakle ei kaj ar na korim! (fuck you windows)

Collapse
 
tranquyen profile image
Đặng Trần Quyền

How can we emmed this to Visual Studio Code ?

Collapse
 
axselll profile image
Axsel Riando S

i can't do a command like 'cd' anyone have the same issue?

Collapse
 
soadtech profile image
Fernando Ropero

Customizing Cygwin & Oh-my-zsh
step four is not clear to me, I don't know what to do, I can't find any files .minttyrc

Collapse
 
ferdinandweidner profile image
Georg Ferdinand Weidner

Hey there,

can not do this one "git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh", because of new policy of git. Does anyone has an alternative link?

Collapse
 
barisvelioglu profile image
Barış Velioğlu • Edited

You can use git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh