Skip to content

Instantly share code, notes, and snippets.

@johncf
Last active October 13, 2024 15:15
Show Gist options
  • Save johncf/78c69c1c03f49ec4349529259d7a3b1e to your computer and use it in GitHub Desktop.
Save johncf/78c69c1c03f49ec4349529259d7a3b1e to your computer and use it in GitHub Desktop.
Setting up Windows for development (Scoop, MSys2, Alacritty, BuildTools etc.)

Scoop

To install Scoop (official docs), execute in Powershell:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh -outfile 'install-scoop.ps1'
get-help .\install-scoop.ps1
.\install-scoop.ps1

Add extras bucket:

scoop bucket add extras

Install utilities:

scoop install ffmpeg libavif exiftool
scoop install python sublime-text

MSYS2

To install MSYS2 using Scoop:

scoop install msys2

Execute msys2 to do initial setup. After this, files in MSYS2 can be found in: <scoop_root_path>\apps\msys2\current and <scoop_root_path>\persist\msys2\ where <scoop_root_path> is C:\Users\<user>\scoop by default.

Install development utilities:

pacman -Syu
pacman -S git vim curl zsh tmux mingw-w64-ucrt-x86_64-jq
pacman -S mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-pkgconf

Now exit from msys2 and enter ucrt64 from Powershell.

If you want to change the default shell to zsh, make LOGINSHELL=zsh in <scoop_root>\apps\msys2\current\msys2_shell.cmd.

Powershell 7 (pwsh)

This is much faster than Windows Powershell. Either download the MSI here, or use Scoop:

scoop install pwsh

Alacritty

To install MSYS2 using Scoop:

scoop install alacritty

If you want to use tmux with Ctrl-Space as the prefix, you'll need to workaround the issue that Ctrl-Space (which sends a NULL character) is completely ignored for some reason in Windows. So map the tmux prefix to a sequence that you don't use otherwise, which I just kept to the default tmux prefix, Ctrl-b. Then have Alacritty send that sequence when you press Ctrl-Space by using the following config (ref1, ref2):

shell = "pwsh"

[window]
dimensions = { columns = 150, lines = 32 }
padding = { x = 4, y = 4 }

[selection]
save_to_clipboard = true

[[keyboard.bindings]]
key = "Space"
mods = "Control"
chars = "\u0002"  # Ctrl-b

The above config should be saved to $APPDATA/alacritty/alacritty.toml.

Note: Even with Alacritty, using Vim within Tmux (on MSYS2) is very sluggish. So recommended to run Vim outside Tmux.

Visual C++ Build Tools

This is required to compile C/C++ libraries or tools for Windows. Download the Visual Studio Installer from here. And select these from the "Individual components" tab:

  • MSVC v143 - VS 2022 C++ x64/x86 build tools (latest)
  • Windows 10 SDK (10.0.XXXXX.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment