Terminal: Using Windows Terminal for MSYS2

Created on 27 Jun 2019  路  7Comments  路  Source: microsoft/terminal

Just out of curiosity, has someone tried to create a profile for using the new terminal with MSYS2?

Thanks...

Area-Interop Issue-Question Product-Terminal Resolution-Answered

Most helpful comment

Use these:

"commandline" : "C:/msys64/msys2_shell.cmd -defterm -no-start -mingw64"
"commandline" : "C:/msys64/msys2_shell.cmd -defterm -no-start -mingw32"

All 7 comments

Yes, works fine, unless you have TERM set to xterm-256color (eg. home and end key not working).
Here is my Profile:

{
    "acrylicOpacity": 0.75,
    "closeOnExit": false,
    "colorScheme": "Argonaut",
    "commandline": "msys2.cmd",
    "cursorColor": "#FFFFFF",
    "cursorShape": "bar",
    "fontFace": "Source Code Pro for Powerline",
    "fontSize": 10,
    "guid": "{09dc5eef-6840-4050-ae69-21e55e6a2e63}",
    "historySize": 9001,
    "icon": "ms-appdata:///roaming/msys2.ico",
    "name": "MSYS2",
    "padding": "0, 0, 0, 0",
    "snapOnInput": true,
    "useAcrylic": true
}

With msys2.cmd containing the code below, as there is currently no way to set environment variables for profiles (has to be availabe from PATH).

@echo off
setlocal

set PATH=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Docker\Docker\resources\bin
set MSYS2_PATH_TYPE=inherit
REM set TERM=xterm-256color
set MSYSROOT=C:\tools\msys64
if "%MSYSTEM%"=="" (
    set MSYSTEM=MSYS
)

set CHERE_INVOKING=1
%MSYSROOT%\usr\bin\zsh.exe --login

@MoeRT09, yes, at the moment, the only solution to start MSYS2 and friends is to create an _ad hoc_ .cmd file to set the needed environment variables...

Just this works,

"commandline": "c:/msys64/usr/bin/bash.exe --login -i",

but without setting the environment.

Maybe, soon, the Windows Terminal developers will add this possibility to the profiles settings.

Thanks.

If you installed them with scoop - scoop install msys2, you can just use this

        {
            "acrylicOpacity" : 0.75,
            "closeOnExit" : true,
            "colorScheme" : "flat-ui-v1",
            "commandline" : "cmd /c msys2",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "historySize" : 9001,
            "icon" : "%SCOOP%\\apps\\msys2\\current\\msys2.ico",
            "name" : "MSYS2",
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "startingDirectory" : ".",
            "useAcrylic" : true
        },
        {
            "acrylicOpacity" : 0.75,
            "closeOnExit" : true,
            "colorScheme" : "flat-ui-v1",
            "commandline" : "cmd /c mingw64",
            "cursorColor" : "#FFFFFF",
            "cursorShape" : "bar",
            "fontFace" : "Consolas",
            "fontSize" : 10,
            "historySize" : 9001,
            "icon" : "%SCOOP%\\apps\\msys2\\current\\mingw64.ico",
            "name" : "MinGW64",
            "padding" : "0, 0, 0, 0",
            "snapOnInput" : true,
            "startingDirectory" : ".",
            "useAcrylic" : true
        },

Use these:

"commandline" : "C:/msys64/msys2_shell.cmd -defterm -no-start -mingw64"
"commandline" : "C:/msys64/msys2_shell.cmd -defterm -no-start -mingw32"

Hi, for a solution with full terminal capability, check out:

https://github.com/rkitover/windows-alt-sshd-msys2

@MeowningMaster, yes I know but I am using this:

{
                "guid": "{9c173dff-f524-43df-b40e-29953998c744}",
                "name": "MSYS2 Terminal",
                // From: https://github.com/msys2/MSYS2-packages/issues/1684#issuecomment-634694362
                "commandline": "C:/msys64/usr/bin/env.exe MSYS=winsymlinks:nativestrict MSYSTEM=MSYS /bin/bash --login",
                "startingDirectory": "C:/msys64/home/utente",
                "colorScheme": "MSYS2-Theme",
                "icon": "C:/msys64/msys2.ico"
            }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

zadjii-msft picture zadjii-msft  路  3Comments

NickITGuy picture NickITGuy  路  3Comments

carlos-zamora picture carlos-zamora  路  3Comments

miniksa picture miniksa  路  3Comments