How to change HOME directory and start directory on MSYS2? How to change HOME directory and start directory on MSYS2? windows windows

How to change HOME directory and start directory on MSYS2?


If you would like to use your windows home folder as the home folder for MSYS2, you can edit /etc/nsswitch.conf and write:

db_home: windows


Msys2 will use windows %HOME% as it's $HOME dir. If you set %HOME% in environment variables (to the windows directory you need Msys2 to use) it will work.


In one of your shell startup scripts (e.g. ~/.bash_profile where ~ is the default/original home directory) you can change the $HOME environment variable:

export HOME=/something/else

If you want your shell to open in that directory you might need to run cd (with no arguments) after setting $HOME; I have not tested it.