Skip to content

Instantly share code, notes, and snippets.

@Shoozza
Last active March 10, 2024 09:34
Show Gist options
  • Save Shoozza/ef71ff78b9b04b77b8fc06076f53e3fe to your computer and use it in GitHub Desktop.
Save Shoozza/ef71ff78b9b04b77b8fc06076f53e3fe to your computer and use it in GitHub Desktop.
Installing Luarocks on Windows with MSYS2 and gcc

Installing Luarocks on Windows

Getting Luarocks to work on Windows 8.1/10 with MSYS2 gcc (mingw64)

1. MSYS2 installation

  1. Visit https://www.msys2.org/
  2. Click on the link next to "Download the installer"
  3. Run the installer
  4. Add "C:\msys64\usr\bin" to path
  5. Add "C:\msys64\mingw64\bin" to path
  6. Open cmd.exe
  7. Run pacman -S pacman -S mingw64/mingw-w64-x86_64-gcc
  8. Confirm with enter key

2. Lua installation

  1. Visit http://www.lua.org/
  2. Click on "download"
  3. Click on "get a binary"
  4. Click on "download"
  5. Click on lua-<version>_Win64_bin.zip e.g. lua-5.4.2_Win64_bin.zip or lua5_1_5_Win64_bin.zip (we will install 5.1.x for compatibility with love2d)
  6. Create folder C:\lua
  7. Extract content into C:\lua (exe files should be in C:\lua)
  8. Rename lua<version>.exe into lua.exe
  9. Add C:\lua to PATH
  10. Create C:\lua\include and C:\lua\lib folders
  11. Return to the lua download page in your browser
  12. Click on "LuaBinaries <version> - Release X"
  13. Navigate to "Windows Libraries\Dynamic"
  14. Download "lua-<version>_Win64_dllw6.zip"
  15. Copy include files into C:\lua\include
  16. Copy lib files into C:\lua\lib

3. Luarocks installation

  1. Visit https://luarocks.org/
  2. Click on "install"
  3. Click on "Windows all-in-one executable (64-bit)"
  4. Download file
  5. Extract exe files into C:\lua
  6. Add "%appdata%\luarocks\bin" to PATH

4. Luarocks config

  1. Delete old config: remove luarocks folder in %localappdata% and %appdata%
  2. Open cmd.exe
  3. Run luarocks config variables.LUA_INCDIR C:\lua\include
  4. Run luarocks config variables.LUA_LIBDIR C:\lua\lib
  5. Run luarocks config variables.CC gcc
  6. Run luarocks config variables.LD gcc
  7. Run luarocks -> there should be no config errors left

5. Testing

  1. Try to install something with luarocks e.g. in cmd.exe run "luarocks install tl -> should compile and install tl without errors
  2. Run tl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment