I’ve used Cygwin for over a decade and only recently (a couple of years ago) learned about MSYS2. Cygwin, as one of my CS professors used to say, helps make Windows a real operating system. Saying something like that used to inevitably lead to one of those Windows vs Linux arguments. However, Microsoft seems to have finally agreed with the detractors and decided to bring BASH shell to Windows. This feature seems to only be available in Windows 10, so those still working with Windows 7 still have to fend for themselves.

One of thing I didn’t like about Cygwin, however, was the installer. Mirrors would come and go and the package selection window was not intuitive – very “Windows-y’, in fact. That’s why I was pleasantly surprised by MSYS2. A package manager like pacman was what was missing in Cygwin, at least for me.

MSYS2 is not without bugs, either. For instance, when updating packages, it sometimes asks that you “not return to shell” and instead terminate program. You then might need to run the pacman update command again to make sure the update finishes.

I also have not been able to create a shortcut to it on the Desktop or Taskbar. When you search for it, it shows multiple versions (i.e., MSYS2, MSYS2 MinGW 64-bit, MSYS2 MINGW 32-bit). Other than that, it is a much better alternative in terms of user experience.

Why

A much more important question might be, “Why? Why use Windows at all?” Today, I do not use Windows as a primary dev environment. I used Windows exclusively up until I went to college. I was then introduced to Knoppix (with a “live CD”), and to Ubuntu shortly thereafter. My world changed drastically. I had an Ubuntu/Windows dual-boot setup on my Sony Vaio for a few years (the Windows was just in case I needed to use something like Adobe Photoshp or AutoCAD). When I started working as a .NET Developer, the first thing I did on my new machine was to install Cygwin.

Over the course of five years or so, I slowly made the transition to Mac. It has been one of the best decisions of my life. Much of the enterprise world still uses Windows, however. As a consultant, I interact with organizations that are still dependent on Windows. Most of them provide a Windows machine in order for us to connect to their network.

This is why I still depend on something like MSYS2.

Getting started

Here are my first few commands once I have it installed.

# Update system
pacman -Syu

# Install dev tools
pacman -S base-devel --needed

# Utility tools
pacman -Sy rsync unzip tar diff

# Manpages will come in handy.
pacman -Sy man

# Install Git and SVN.
pacman -Sy git svn

# Install vim
pacman -Sy vim

# Get .vimrc
curl -LO https://raw.githubusercontent.com/henokmikre/dotfiles/master/.vimrc

# Install Vundle.
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

# Install vim plugins (from .vimrc)
vim +PluginInstall +qall

# Create useful aliases.
echo "alias vi='vim'" >> .bash_profile
echo "alias ll='ls -l'" >> .bash_profile
source ~/.bash_profile

# Create SSH key.
# https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

The home directory is located at /c/msys64/home/$(whoami) (as opposed to /cygdrive/c/cygwin/home/$(whoami) in Cygwin).

Resources