Cygwin + Oh-my-zsh + Solarized Theme + apt-cyg on Windows 10

As a Python developer as well as a long-time avid user of Linux and Mac OS, I just could not use a computer without a unix-like shell and a decent command-line interface. Thus kept digging until I found the perfect solution for me, the title of the post itself. Let’s get started.

cygwin

Install Cygwin

According to the website of Cygwin, Cygwin is “a large collection of GNU and Open Source toolswhich provide functionality similar to a Linux distribution on Windows.” It provides a decent terminal interface with the GNU / Unix tools you love and crave for. You should download the 32-bit (setup-x86.exe) or 64-bit (setup-x86_64.exe) installer according to the configuration of your computer.

cygwin installation

Open the installer and follow the on-screen instructions, on the package selection screen, make sure to install at least zsh, git, nano and wget alongside the default selections. Once the installation is complete, you will find a Cygwin Terminal in your Start Menu (Is it still called start?).

[Note: Install the Cygwin git even if you already have Git for WIndows installed.]

Set zsh as the default shell

Open up Cygwin Terminal. Cygwin does not have chsh for changing shells, nor does it have a /etc/passwd file. Thus, we need to make one (Thanks BrunoLM).

mkpasswd -l -p "$(cygpath -H)" > /etc/passwd

Open the /etc/passwd file for editing.

nano /etc/passwd

You will be presented with a gigantic text file. Find the line that begins with your username. Go the the end of that line, and replace /bin/bash with /bin/zsh.

Install oh-my-zsh

oh-my-zsh is a configuration (+ theme / plugin system) for the Z Shell. The oh-my-zsh installation script should be fetched and executed through the “wget method”, since we did not yet install curl. So, in the Cygwin Terminal and paste the following,

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

zsh should be installed and ready for configuration.

Solarized Theme and Powerline fonts

Karlin Fox ported the Solarized theme to MinTTY (the terminal which comes by default with Cygwin), and it is available at karlin/mintty-colors-solarized.

git clone https://github.com/karlin/mintty-colors-solarized.git ~/.solarized
echo 'source ~/.solarized/mintty-solarized-dark.sh' >> ~/.zshrc # for light, replace dark with light

Some fancy zsh themes require powerline-patched fonts. Powerline patched versions of the most popular mono fonts are available at powerline/fonts. Install the ones required after cloning / downloading (zip) the repository. Make sure to change the font of MinTTY.

MinTTY

Right click the title bar of the Terminal, click Options. Change your font to a Powerline patched font you installed.

Install apt-cyg

apt-cyg acts similar to apt-get, works great for installing packages! Installation is fairly straightforward,

lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin

That should help you get started!