Skip to content

Instantly share code, notes, and snippets.

@aviaryan
Last active February 9, 2024 03:22
Show Gist options
  • Star 52 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save aviaryan/5a57aa25b140f6c48f0e to your computer and use it in GitHub Desktop.
Save aviaryan/5a57aa25b140f6c48f0e to your computer and use it in GitHub Desktop.
Installing zsh and oh-my-zsh on Windows
  1. Install zsh from cygwin
  2. Install oh-my-zsh from https://github.com/robbyrussell/oh-my-zsh . Follow the manual instructions
  3. To make zsh default on ConEmu, create a task with C:\cygwin64\bin\mintty.exe /usr/bin/zsh - . Make it the defaut shell.
  4. To start a zsh shell on demand, add this batch script to your path or start menu or wherever.
start C:\cygwin64\bin\mintty.exe /usr/bin/zsh -
@ronaiza-cardoso
Copy link

I have to create the directory /usr/bin/zsh?
image

I already fallow the manual instalation

@rlabrecque
Copy link

Why not use "Bash on Windows" instead of cygwin?

Copy link

ghost commented Apr 27, 2017

@rlabrecque You mean Bash on Ubuntu on Windows? I think the most plausible and common reason is because Ubuntu Bash on Windows cannot interact with other Windows tools, wherein you'll need to install packages separately (ie. install gcc, rustc, or other build tools separately).

Also, in the devops side of things, Docker does not run on Bash on Ubuntu on Windows for some reason, and running server infrastructure including virtualization is generally discouraged... which makes sense since you can do that in Windows anyways. But it would be great if you can execute your docker scripts in the command line that feels like you're in a *nix system.

Cygwin allows you to use all of your windows tools, in a "better" shell environment, not to forget that you can also effortlessly create symlinks, run most scripts that wouldn't work in Windows (like linking some program to your PATH, the *nix way... creating symlinks...), etc.

@ElusiveByte
Copy link

@yesroh I'm facing the same problem. Did you found any solution?

@pmasodariya
Copy link

Try this:
start C:\cygwin64\bin\mintty.exe /bin/zsh -

@jacobrayschwartz
Copy link

jacobrayschwartz commented Aug 21, 2017

@rlabrecque There is also the issue of enterprise companies/machines. Many companies are still on Windows 7, so Windows Subsystem for Linux is not available for folks using those machines.

@vallamost
Copy link

vallamost commented Aug 25, 2017

This is what you actually want:

https://evdokimovm.github.io/windows/zsh/shell/syntax/highlighting/ohmyzsh/hyper/terminal/2017/02/24/how-to-install-zsh-and-oh-my-zsh-on-windows-10.html

Following up this awesome guide, here's how you can invoke native Windows apps from the bash shell running in the WSL -
https://msdn.microsoft.com/en-us/commandline/wsl/release_notes#build-14951

Now you can build your favorite aliases

@lski
Copy link

lski commented Sep 15, 2017

As an alternative to adding "/usr/bin/zsh" to the command line, you can add the following to the end of your ~/.bashrc file. So it would apply to all environments that use that .bashrc, not just mintty, like ConEmu etc, but only needing to do it in one place.

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

I use this method with WSL (Bash on Windows) after installed oh-my-zsh on that too.

The command line option is great for people using just mintty, so I'm not saying that is the wrong way, this is just an alternative :)

@nea89o
Copy link

nea89o commented Sep 18, 2017

@ronaiza-cardoso try relaunching the cygwin setup and selecting the zsh package if it asks you for which packages to install.. if you let the install dirs point to the current installation it only updates those packages...

@jef
Copy link

jef commented Nov 29, 2017

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

this worked. thanks @lski!

@bytefluxio
Copy link

@jacobrayschwartz:

enterprise companies/machines. Many companies are still on Windows 7
It's not even available for Windows 10 Enterprise LTS

@ufosaga
Copy link

ufosaga commented Jan 10, 2019

cygwin_zsh

run mkpasswd -l /etc/passwd to generate the passwd config.
then modify the default shell to zsh for the specified user.
have fun.

@HaroldBrenesH
Copy link

we need up it to chocolatery

@elucidsoft
Copy link

I really freaking hate how awful the terminal stuff is on Windows. This is a perfect example...

@bohdanmykytey
Copy link

use Ubuntu - it's free

@retsi101
Copy link

It's amazing, I tried running the command:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

But it deletes Mintty.

What should be done?

@NileshMS
Copy link

NileshMS commented Feb 5, 2023

Mintty throwing below message prompt. how can I stop this annoying prompt? its happening when I am closing git bash.

image

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