Building Lua 5.3 on macOS
Posted on January 12, 2013 by Paul
Updated 7 October 2017
If you want to build yourself the latest Lua on macOS there is a simple recipe for this:
- Start by downloading the Lua source code from http://www.lua.org/ftp/.
- Extract the archive (I did this in my Downloads folder).
- Open a Terminal and navigate to the Lua source code:
- Decide where you want to install Lua on your system, the default is /usr/local. My recommendation is to install Lua in /usr/local/lua-5.3.
- Build and install Lua:
In order to be able to use Lua, we’ll need to add the interpreter to our system path, paste the next line in a Terminal:
If you want to permanently add Lua to your path, use:
Start the interpreter by writing in the Terminal:
Try some Lua expressions in the interpreter:
You can permanently add Lua to your system path by saving the above export line at the end of your .bash_profile file.
If you are interested in learning Lua, I would recommend reading Programming in Lua by Roberto Ierusalimschy:
Show Comments