下載並安裝msys2
修改鏡像服務器 下面的命令必須在msys2裏面執行
echo "Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686/" > /etc/pacman.d/mirrorlist.mingw32
echo "Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64/" > /etc/pacman.d/mirrorlist.mingw64
echo "Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/\$arch/" > /etc/pacman.d/mirrorlist.msys
把ming64的路徑加到環境變量
echo "export MINGW=/mingw64" >> ~/.bash_profile
echo "export PATH=\$MINGW/bin:\$PATH" >> ~/.bash_profile
上面修改鏡像服務器的操作,會在這個目錄C:\msys64\etc\pacman.d生成3個文件
mirrorlist.mingw32
mirrorlist.mingw64
mirrorlist.msys
添加環境變量的操作,可以在這樣確認 cat ~/.bash_profile。在.bash_profile文件裏面添加兩行
export MINGW=/mingw64
export PATH=$MINGW/bin:$PATH
在Windows Terminal中集成msys2
https://www.msys2.org/docs/terminals/
直接編輯Windows的terminal的json配置文件settings.json
C:\Users\clu\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState
在profiles的list裏面,新增
{
"guid": "{17da3cac-b318-431e-8a3e-7fcdefe6d114}",
"name": "UCRT64 / MSYS2",
"commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -ucrt64",
"startingDirectory": "C:/msys64/home/%USERNAME%",
"icon": "C:/msys64/ucrt64.ico",
"font":
{
"face": "Lucida Console",
"size": 9
}
},
{
"guid": "{71160544-14d8-4194-af25-d05feeac7233}",
"name": "MSYS / MSYS2",
"commandline": "C:/msys64/msys2_shell.cmd -defterm -here -no-start -msys",
"startingDirectory": "C:/msys64/home/%USERNAME%",
"icon": "C:/msys64/msys2.ico",
"font":
{
"face": "Lucida Console",
"size": 9
}
},
MSYS2: What's the difference between UCRT 64 and x64?
Please take a look at the following guide: https://www.msys2.org/docs/environments/
The default MINGW32 and MINGW64 environments build binaries using the older MSVCRT library that should be present on all Windows systems.
The MINGW UCRT environments build binaries using the newer UCRT library that is only known to be present on Windows 10. It should produce binaries more compatible with MSVC-compiled binaries, but not with the MSVCRT environment.
bash: git: command not found in MSYS
pacman -S git
yes | pacman -Syu git
查看本機的architecture,在msys2裏面執行
echo $(uname -m)