This guide demonstrates how to install/setup Lua and its related programs for your development environment. Only follow this guide for local installation to either OS X or Ubuntu 16.04.

1. Install the binaries

You will install Lua and LuaRocks. Lua is the interpreter used to execute Lua code, and LuaRocks is the package manager used to install Lua code developed by other people.


Install the Homebrew package manager. Then run:

brew update
brew install lua

Ubuntu 16.04

sudo apt-get install lua5.2 liblua5.2-dev
pushd /tmp
tar -xf luarocks-2.4.3.tar.gz
pushd luarocks-2.4.3
make build && sudo make install
popd && popd

Windows 10

Get Bash on Ubuntu on Windows using these instructions then follow the Ubuntu guide.


The Rice machines are Stanford’s shared servers. You can access them by running ssh from the command line or using PuTTY.

Lua and LuaRocks are already installed with the correct versions on the Rice machines.

2. Install Lua packages

Once Lua and LuaRocks are installed, you can verify this by running the lua command to get an interactive interpreter. You should be running Lua 5.2 (check lua -v).

Lastly, you’ll need to install the following packages for this course:

luarocks install luaposix
luarocks install termfx

You can confirm that these packages installed correctly by running:

lua -e 'require "termfx"'

3. Configure your editor

Most editors (Vim, Emacs, Atom, VSCode, Sublime) have a Lua syntax highlighter preinstalled, so editing Lua code should just work!