File locations
This is a summary of all file paths related to LuaRocks, including the files that compose LuaRocks (its scripts and modules), files installed by LuaRocks (Lua modules and scripts), and files required by LuaRocks (programs, libraries and headers).
For each path, the default value is also listed.
Whenever "5.x" is used, it refers to the Lua version you configured during installation.
- LuaRocks command-line scripts. These are the main LuaRocks commands (luarocks, luarocks-admin); it should be in your system PATH.
- Unix default: /usr/local/bin
- LuaRocks modules. These are Lua modules (luarocks.fs, etc.) used by LuaRocks. The LuaRocks command-line tools are configured during installation to be able to find those files.
- Unix default: /usr/local/share/lua/5.x/
- Lua interpreter. Where to find the Lua interpreter to execute scripts and LuaRocks itself.
- Unix default: /usr/local/bin/lua
- Lua libraries. The directory containing the Lua virtual machine as a shared library. On some platforms, Lua modules written in C (also called "C modules") should link against this library
- Unix default: /usr/local/lib
- Lua header files (lua.h, etc.). They are required when compiling C modules.
- Unix default: /usr/local/include
For Windows users, having libraries and headers around may be uncommon, as Windows tends to have binary distributions. LuaRocks can provide binary rocks, but rocks in the standard repository are often available only as source code and need to be compiled during the installation process.
LuaRocks by default is configured to use two rocks trees:
- System-wide rock tree (used by default)
- Unix default: /usr/local/
- Per-user rock tree (may be selected by the user with the --local flag).
- Unix default: $HOME/.luarocks/
On Unix, performing a vanilla installation of Lua from lua.org and a vanilla installation of LuaRocks will install both under /usr/local, meaning that the environment variables for the system-wide rock tree are correct by default.
The command luarocks path outputs the correct environment variables set for a rock tree.
Rocks may also deploy command-line scripts. This location is relative to the rock tree where they are installed:
- System-wide rock tree (used by default)
- Unix default: /usr/local/bin/
- Per-user rock tree (may be selected by the user with the --local flag).
- Unix default: $HOME/.luarocks/bin/
On Unix, /usr/local/bin is usually in the $PATH by default, but $HOME/.luarocks/bin is not.
The command luarocks path --bin outputs the correct PATH environment variables set for a rock tree.
For compiling modules written in C, you need a compiler toolchain installed.
For many platforms this is a non-issue: Linux distribution often include gcc (the default installation of Ubuntu, notably, ships without build tools by default: run sudo apt-get install build-essential).
On Windows, where binary distribution is the standard, this might be an additional requirement. Because more rocks are available as source code than as binary rocks, it is probably best to have a C compiler available. LuaRocks supports MinGW and the Microsoft Visual Studio toolchains. The compiler should be in the system path, or explicitly configured in the LuaRocks config files.