Running Lua on macOS

Lua is a lightweight programming language and has good reputation among game engines. In this article, you will learn how to install and use the latest version of Lua (5.2.x) on Mavericks, Mountain Lion, Lion or Snow Leopard.

How to Install

Rudix provides Lua pre-compiled packages for Mavericks, Mountain Lion, Lion and Snow Leopard. The page you will going to access is

After you download, double click the package and follow the installation instructions.

Default installation path

Lua will be installed under /usr/local/ and the full path for the Lua interpreter will be /usr/local/bin/lua, but you don’t need to type the full path every time you want to call Lua, it’s OK just to type lua on the Terminal to get the interpreter.

Important files:


Security note for Mountain Lion and Mavericks

On Mountain Lion and Mavericks things are a bit hard, you will probably get “lua-5.2.1-0.pkg” can’t be opened because it is from an unidentified developer. This means that the package was not registered with Apple – but you can choose to trust Rudix developers (I’m the author) and install anyway.

Here is how to bypass once your security settings:

  1. Press the Control key and click the package.
  2. Choose Open from the pop-up menu.
  3. Click Open button.

Now follow the installation instructions.

Testing Lua

Test if your installation is OK by printing “Hello World!”.

Lua 5.2.1  Copyright (C) 1994-2012, PUC-Rio
> print ("Hello World!")
Hello World!

Type Control+D to exit.