# 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](https://web.archive.org/web/20161220011130im_/http://i.imgur.com/bRcza7o.png align="left")

### Install Cygwin

According to the website of [Cygwin](https://web.archive.org/web/20161220011130/https://www.cygwin.com/), Cygwin is “a large collection of **GNU and Open Source tools**which 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](https://web.archive.org/web/20161220011130/https://www.cygwin.com/setup-x86.exe)) or 64-bit ([setup-x86\_64.exe](https://web.archive.org/web/20161220011130/https://www.cygwin.com/setup-x86_64.exe)) installer according to the configuration of your computer.

![cygwin installation](https://web.archive.org/web/20161220011130im_/http://i.imgur.com/voo38GV.png align="left")

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](https://web.archive.org/web/20161220011130/http://superuser.com/questions/351435/zsh-with-cygwin#comment1487113_351437)).

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

Open the `/etc/passwd` file for editing.

```bash
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](https://web.archive.org/web/20161220011130/https://github.com/robbyrussell/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,

```bash
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](https://web.archive.org/web/20161220011130/https://github.com/karlin/mintty-colors-solarized).

```bash
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](https://web.archive.org/web/20161220011130/https://github.com/powerline/fonts). Install the ones required after cloning / downloading (zip) the repository. Make sure to change the font of MinTTY.

![MinTTY](https://web.archive.org/web/20161220011130im_/http://i.imgur.com/fsYzdxk.png align="left")

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](https://web.archive.org/web/20161220011130/https://github.com/transcode-open/apt-cyg) acts similar to apt-get, works great for installing packages! Installation is fairly straightforward,

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

That should help you get started!
