Install LuaRocks
LuaRocks installation varies by operating system. Follow the instructions for your system below to get LuaRocks up and running.
Linux Installation
Ubuntu/Debian
sudo apt update
sudo apt install luarocksCentOS/RHEL/Fedora
# For Fedora
sudo dnf install luarocks
# For CentOS/RHEL
sudo yum install luarocksArch Linux
sudo pacman -S luarocksFrom Source (Recommended for latest version)
If the package manager version is outdated:
# Download latest version
wget https://luarocks.org/releases/luarocks-3.9.2.tar.gz
tar zxpf luarocks-3.9.2.tar.gz
cd luarocks-3.9.2
# Configure and install
./configure
make
sudo make installmacOS Installation
Using Homebrew (Recommended)
brew install luarocksUsing MacPorts
sudo port install luarocksFrom Source
If you prefer manual installation or need the latest version:
# Install Xcode Command Line Tools if not already installed
xcode-select --install
# Download and compile
curl -R -O https://luarocks.org/releases/luarocks-3.9.2.tar.gz
tar zxf luarocks-3.9.2.tar.gz
cd luarocks-3.9.2
./configure && make && sudo make installWindows Installation
Using Chocolatey
choco install luarocksManual Installation
- Download the Windows installer from luarocks.org
- Run the installer
- Follow the installation wizard
- Ensure Lua is installed first (see Lua installation guide)
Verifying Installation
After installation, verify LuaRocks is working:
luarocks --versionYou should see output like:
LuaRocks 3.9.2Configuration
LuaRocks automatically detects your Lua installation. To check configuration:
luarocks configThis shows your Lua version, tree locations, and other settings.
Common Installation Issues
Permission Errors
If you encounter permission errors:
# On Unix-like systems
sudo chown -R $USER ~/.luarocksPath Issues
Ensure LuaRocks is in your PATH:
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
export PATH=$PATH:~/.luarocks/binMultiple Lua Versions
If you have multiple Lua versions installed:
# Specify Lua version during configuration
./configure --with-lua=/usr/bin/lua5.4Next Steps
With LuaRocks installed, learn how to use LuaRocks to install and manage Lua packages.
For more installation details and troubleshooting, visit the LuaRocks documentation.
Last updated on