Posted in Software Development on 07 Feb 2026 at 22:10 UTC
Just a quick post to share how to install universal (arm64+x64) Lua modules on macOS using LuaRocks, since by default it only compiles for the current architecture and I couldn't find it documented anywhere:
$ luarocks \
CFLAGS="-arch arm64 -arch x86_64" \
LIBFLAG="-arch arm64 -arch x86_64 -undefined dynamic_lookup -all_load" \
install someluamodule
The CFLAGS parameter does what you would expect, and LIBFLAG is the flags supplied to the link command when linking dynamic libraries. I looked at a few modules and the default values for macOS varied a bit, but -undefined dynamic_lookup -all_load seems to be a good default for most/all modules.
No comments have been posted