Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Frontear/23731704f373c0ce4ddec9784b57d420 to your computer and use it in GitHub Desktop.
Save Frontear/23731704f373c0ce4ddec9784b57d420 to your computer and use it in GitHub Desktop.
Instructions to remind myself how to set up MSYS2 as my default terminal in Windows.

Setting Up MSYS2 as Default Terminal

  1. Download and install MSYS2: https://www.msys2.org/.
  2. Open MSYS2 and run pacman -Syu to update packages.
  3. Open file explorer and go to C:\msys64.
  4. Open all the INI files for the systems (clang32.ini, clang64.ini, mingw32.ini, mingw64.ini, msys2.ini) and uncomment the MSYS2_PATH_TYPE=inherit line. This allows the Windows $PATH variable to be included in the shells.
  5. Download and install Windows Terminal from the Windows store.
  6. Open the settings for Windows Terminal and click "Open JSON".
  7. Copy and paste the following objects into the "list" array under "profiles":
{
  "commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -clang64 -use-full-path",
  "font": 
  {
    "face": "Lucida Console",
    "size": 15
  },
  "guid": "{8629afd6-5d0e-406c-a523-d26a47398b26}",
  "hidden": true,
  "icon": "C:/msys64/mingw64.ico",
  "name": "CLANG64 / MSYS2",
  "startingDirectory": "C:/Users/%USERNAME%/Developer"
},
{
  "commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -clang32 -use-full-path",
  "font": 
  {
    "face": "Lucida Console",
    "size": 15
  },
  "guid": "{b1feb804-7dd2-48da-be0e-f24db4bbd880}",
  "hidden": true,
  "icon": "C:/msys64/mingw32.ico",
  "name": "CLANG32 / MSYS2",
  "startingDirectory": "C:/Users/%USERNAME%/Developer"
},
{
  "commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -mingw64 -use-full-path",
  "font": 
  {
    "face": "Lucida Console",
    "size": 15
  },
  "guid": "{17da3cac-b318-431e-8a3e-7fcdefe6d114}",
  "hidden": true,
  "icon": "C:/msys64/mingw64.ico",
  "name": "MINGW64 / MSYS2",
  "startingDirectory": "C:/Users/%USERNAME%/Developer"
},
{
  "commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -mingw32 -use-full-path",
  "font": 
  {
    "face": "Lucida Console",
    "size": 15
  },
  "guid": "{2d51fdc4-a03b-4efe-81bc-722b7f6f3820}",
  "hidden": true,
  "icon": "C:/msys64/mingw32.ico",
  "name": "MINGW32 / MSYS2",
  "startingDirectory": "C:/Users/%USERNAME%/Developer"
},
{
  "commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -msys -use-full-path",
  "font": 
  {
    "face": "Lucida Console",
    "size": 15
  },
  "guid": "{863375d3-ac24-4169-a605-88a63c2cf5bc}",
  "icon": "C:/msys64/msys2.ico",
  "name": "MSYS / MSYS2",
  "startingDirectory": "C:/Users/%USERNAME%/Developer"
},

{
  "commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -ucrt64 -use-full-path",
  "font": 
  {
    "face": "Lucida Console",
    "size": 15
  },
  "guid": "{71160544-14d8-4194-af25-d05feeac7233}",
  "icon": "C:/msys64/msys2.ico",
  "name": "UCRT64 / MSYS2",
  "startingDirectory": "C:/Users/%USERNAME%/Developer"
},
  1. Change default terminal to one of the profiles.
  2. Open VS Code and open the settings in JSON
  3. Under terminal.integrated.profiles.windows (create if not existing as an object), add the following:
"msys2": {
    "path": "C:/msys64/usr/bin/bash.exe",
    "args": ["--login"],
    "env": {
        "CHERE_INVOKING": "1",
        "MSYSTEM": "UCRT64",
        "MSYS2_PATH_TYPE": "inherit"
    }
}
  1. Under terminal.integrated.defaultProfile.windows (create if not existing as a string), set to "msys2"
  2. If clang64, mingw64, or other is needed, copy-paste the profile and change "MSYSTEM".
  3. Go into the settings for Windows and change default terminal to Windows Terminal.
@Frontear
Copy link
Author

Outdated, please use the tutorial found on MSYS website: https://www.msys2.org/docs/terminals/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment