How Do I Install Lua on MacOS?

Compiling from source code is not that painful.

Lua 5.1.4 here: http://www.lua.org/ftp/lua-5.1.4.tar.gz Lua 5.2 alpha here: http://www.lua.org/work/lua-5.2.0-alpha.tar.gz

Take Lua 5.2 as example:

  1. Open your Terminal.app
  2. wget http://www.lua.org/work/lua-5.3.0-work3.tar.gz
  3. tar xvzf lua-5.3.0-work3.tar.gz
  4. cd lua-5.3.0-work3/src
  5. make macosx(I believe you have Xcode installed)

After that, you can see 'lua' binary under current dir.

sudo cp lua /usr/bin/lua

Now you can enter lua to have a try. :)


This Wiki has few listing: http://lua-users.org/wiki/MacOsxLua

If you use Homebrew (https://brew.sh/), just type:

brew update
brew install lua

If you have brew installed, just try:

brew install lua


You just follow this guide on http://www.lua.org/start.html:

Fire up your terminal and type in:

curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
tar zxf lua-5.3.5.tar.gz
cd lua-5.3.5
make macosx test
make install

You can even combine the last two steps to

make macosx install

After that I could just type in

lua

into my terminal and something like:

Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio

should appear. This means that lua is installed correctly.

Tags:

Macos

Lua