Lua Getting started with Lua Installation



Lua binaries are provided by most GNU/Linux distributions as a package.

For example, on Debian, Ubuntu, and their derivatives it can be acquired by executing this:

sudo apt-get install lua50
sudo apt-get install lua51
sudo apt-get install lua52

There are some semi-official builds provided for Windows, MacOS and some other operating systems hosted at SourceForge.

Apple users can also install Lua easily using Homebrew:

brew install lua

(Currently Homebrew has 5.2.4, for 5.3 see Homebrew/versions.)


Source is available at the official page. Acquisition of sources and build itself should be trivial. On Linux systems the following should be sufficient:

$ wget
$ echo "a0341bc3d1415b814cc738b2ec01ae56045d64ef ./lua-5.3.3.tar.gz" | sha1sum -c -
$ tar -xvf ./lua-5.3.3.tar.gz
$ make -C ./lua-5.3.3/ linux

In the example above we're basically downloading a source tarball from the official site, verifying its checksum, and extracting and executing make. (Double check the checksum at the official page.)

Note: you must specify what build target you want. In the example, we specified linux. Other available build targets include solaris, aix, bsd, freebsd, macosx, mingw, etc. Check out doc/readme.html, which is included in the source, for more details. (You can also find the latest version of the README online.)


Standard libraries are limited to primitives:

  • coroutine - coroutine management functionality
  • debug - debug hooks and tools
  • io - basic IO primitives
  • package - module management functionality
  • string - string and Lua specific pattern matching functionality
  • table - primitives for dealing with an essential but complex Lua type - tables
  • os - basic OS operations
  • utf8 - basic UTF-8 primitives (since Lua 5.3)

All of those libraries can be disabled for a specific build or loaded at run-time.

Third-party Lua libraries and infrastructure for distributing modules is sparse, but improving. Projects like LuaRocks, Lua Toolbox, and LuaDist are improving the situation. A lot of information and many suggestions can be found on the older Lua Wiki, but be aware that some of this information is quite old and out of date.