Change default shell on MSYS2

I ran into this using the newer msys2-launcher, that provides .exe launchers rather than batch files.

For this, it was simply a matter of changing the .ini files alongside the launchers inside the Msys2 root directory (for a 64-bit installation, it might contain msys2.ini, mingw32.ini and mingw64.ini). For each of those ini files, add a line to set the shell:

SHELL=/usr/bin/zsh

I just ran into this problem. To get zsh running I did this:

  • Installed MSYS2
  • From the directory I installed MSYS2, I ran mingw32_shell.bat
  • Upgraded all installed packages by running pacman -Syu
  • Installed zsh and curl by running pacman -Sy zsh curl
  • Closed the MinGW shell by running exit - I did not run zsh immediately after installation.
  • Edited msys2_shell.bat, mingw32_shell.bat, and mingw64_shell.bat and changed every instance of: start %WD%mintty -i /msys2.ico /usr/bin/bash --login %* to: start %WD%mintty -i /msys2.ico /usr/bin/zsh --login %* (on line 39 as of 2015-09-23)
  • Ran mingw32_shell.bat
  • At the zsh configuration menu I select 0 to create the .zshrc file.

When configuration finished I saw:

zsh-newuser-install:1119: command not found: rm

Which didn't look right... since rm should never net be found on a healthy *nix system (I'm guessing it's a bug with MSYS2's zsh package), but everything ran fine after that.

The first time I tried this when I ran opened up a batch file to create a new session I received an error about zsh's memory space already being occupied. To fix this I closed all open MinTTY windows and ran the autorebase.bat file in the MSYS2 installation directory. Everything worked after that.

Then I installed oh-my-zsh. Using:

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


Edit /etc/nsswitch.conf, and change the setting below:

db_shell: /bin/zsh