Search code examples
macoslua

How Do I Install Lua on MacOS?


I just downloaded Lua from the official website.

I want to install it on my Mac but I have no clue how. And I've never tried using Mac to install and use compilers other than (xcode, titanium, corona) so go easy on me please :)

I tried this link but it does not work.

Also is there a full guide on how to install and start using Lua on mac? Because all I see is windows :S

note: Before I asked this question I searched on SOV but I could not find my answer.


Solution

  • 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. :)