LinuxmacOSWindows

Where Does LuaRocks Store Rocks and Config?

LuaRocks installs rocks into a versioned tree with config.lua beside it, defaulting under the install prefix.

Last updated

LuaRocks keeps downloaded modules in a tree of Lua version folders next to its config file. The default root follows the install prefix, which surprises users who expected everything in home.

User installs redirect with --local into ~/.luarocks instead. That split is worth knowing before mixing sudo and user installs, since the two trees never see each other.

Where LuaRocks stores this, by platform

Linux
~/.luarocks

User tree from --local installs with share/lua and lib/luarocks/rocks inside. System installs use /usr/local/lib/luarocks instead. Config at ~/.luarocks/config.lua overrides defaults.

macOS
~/.luarocks

Same user tree on Mac. Homebrew Lua pairs with a user tree to avoid permission fights. Run luarocks config to print the effective paths.

Windows
C:\Program Files (x86)\LuaRocks

Default system tree on Windows. User installs redirect under %APPDATA%\LuaRocks. The config.lua beside each tree records which Lua it serves.

Frequently asked questions

where are my luarocks modules installed

In the rocks folder of the active tree: ~/.luarocks on Unix user installs. Run luarocks config to print every effective path instead of guessing.

should i use sudo with luarocks

Prefer --local user installs into ~/.luarocks. Sudo installs land in the system tree and tangle permissions for later user installs.

Notice an outdated path? Let us know.