Frederic Cambus

Home · Archives · Text Mode · GitHub · Twitter · RSS

Luarocks on FreeBSD

· Lua · FreeBSD

As LuaRocks is unfortunately not part of the FreeBSD ports collection, it has to be compiled manually. As I'm going to need to repeat this process in the foreseeable future, I decided to document the required steps here.

The reason why I'm targeting Lua 5.1 specifically is that I'm installing Luarocks to build rocks to be used with the Nginx Lua module, as I plan to migrate the Telize server to FreeBSD.

Installing Lua and some required packages

pkg install lua51 gmake curl

Fetching, unpacking, and configuring using Curl as downloader

curl -O http://luarocks.org/releases/luarocks-2.2.0.tar.gz
tar xvfz luarocks-2.2.0.tar.gz
cd luarocks-2.2.0
./configure --with-lua-include=/usr/local/include/lua51 --with-downloader=curl
make build && make install
make bootstrap

Building and installing some Lua modules

luarocks build lua-cjson
luarocks build lua-iconv

Verifying that our modules have been built and installed successfully

ls /usr/local/lib/lua/5.1
cjson.so    iconv.so