Running oh-my-fish on Ubuntu on Windows

Having a proper shell when working on a Unix environment is a must, especially as a software developer. That’s the reason great shells like fish or zsh exist: They simplify a lot of tasks and also make working from the terminal pleasant.

When Microsoft introduced Ubuntu on Windows, I was very excited. Finally I would be able to use the great tools I love on Windows, not just on Linux or Mac!

However, the default installation of Ubuntu on Windows basically delivers a bash shell inside the classic cmd terminal. That’s certainly not the optimal configuration, but we can change that easily.

First of all, install curl, git and fish. Make sure to subscribe to the proper packet source so you get the newest versions of git and fish. You will need those to install oh-my-fish.

sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install curl git fish

After that, install oh-my-fish as advised on their github page and select a theme you like.

curl -L http://get.oh-my.fish | fish
fish
omf install agnoster

Depending on your theme, the colors might look terrible. Certain Unicode characters might also be missing, which makes the power line essentially useless.

You can configure proper colors in cmd’s settings. However, there are already a lot of color schemes available online. This github repository has registry-files which will configure a solarized color scheme. Download the file and import it by double clicking.

To fix the missing characters in the powerline, you can install the fonts from this repository. The best way to do so is to clone the repository and then run the install script. Don’t forget that you have to install the fonts on Windows, not Ubuntu on Windows. Also remember to set your powershell execution policy to RemoteSigned, so you can run scripts.

#In Powershell as normal User
git clone git@github.com:powerline/fonts.git
cd fonts
./install.ps1

After you have done so, set a powerline font you like in cmd’s options.

These steps should allow you to have a nicely configured shell running on your Windows machine, looking something like this:

Finally, since Windows calls bash directly when launching Ubuntu for Windows from the start menu, setting fish as your default shell with chsh won’t work. Instead, you can use the following command to immidiately execute fish:

bash -c fish

The command can be invoked from the run prompt (Win+R) or from a desktop or start menu link.

For me, having a proper Unix shell on Windows streamlined a lot of development processes. Finally I can use Windows-only tools like Visual Studio together with Linux-only tools like valgrind, without running a virtual machine, switching computers or copying code around. Awesome!