27

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 then (xcode , titanium , corona) so easy on me please :)

I tried this link but it does not work.

Also Is there a fully guided 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.

hippietrail
  • 15,848
  • 18
  • 99
  • 158
Mohammad Fadin
  • 499
  • 5
  • 11
  • 22
  • 2
    When you say you tried that link and it "does not work", you forgot to mention what, precisely, "did not work". There are about a billion ways (conservatively guessing) for software to "not work". We need a bit more information than that to diagnose the problem. – JUST MY correct OPINION Mar 31 '11 at 07:12

10 Answers10

65

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
jcarballo
  • 27,395
  • 3
  • 28
  • 28
jemeshsu
  • 1,784
  • 16
  • 14
41

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

Cilan
  • 13,101
  • 3
  • 34
  • 51
Prajna
  • 1,217
  • 11
  • 10
  • 1
    Thanks so much. After I entered this command sudo cp lua /usr/bin/lua it asked me for a password. I entered my machine pass but it didn't work. can you help ? :S – Mohammad Fadin Mar 31 '11 at 16:47
  • 3
    See also http://www.lua.org/faq.html#1.1 Change linux to macosx and after building do `make install`. – lhf Mar 31 '11 at 19:46
  • Thanks. I successfully managed to run the compiler. I will get back whenever I have trouble Thanks @lht and @Prajna – Mohammad Fadin Apr 05 '11 at 15:51
  • Thanks for this, worked! Anyone who wants to know, the lua file you need to copy is found under your current dir /src/lua – M.W. Felker Dec 17 '14 at 22:03
  • 7
    To make this possible I had to change /usr/bin/lua to /usr/local/bin/lua and it works fine. – rafaelmorais Sep 09 '16 at 09:38
  • Every guide I've read misses the cp step. its pretty hard to notice that theres a lua bin in there now. The lua binary was in the src directory for me. Also you should install to usr/local/bin – jknight Nov 20 '17 at 18:04
  • 1
    should copy to /usr/local/bin instead of /usr/bin – Dang_Ho Jan 15 '21 at 06:13
23

If you have brew installed, just try:

brew install lua

0bserver07
  • 3,390
  • 1
  • 28
  • 56
3

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.

laka
  • 644
  • 8
  • 23
2

With MacPorts:

sudo port install lua
Stuart P. Bentley
  • 10,195
  • 10
  • 55
  • 84
1

If you have brew, use the following code:

brew update
brew install lua

That works for me.

1

Compile using source on mac

tar -zxvf lua-x.x.x.tar.gz 
cd lua-x.x.x
make macosx
cd src
sudo cp lua /usr/bin/

Type lua and you should get the prompt.
Ajit Surendran
  • 709
  • 7
  • 4
1

I have just follow the Prajna's answer and go to http://www.lua.org/versions.html#5.3 to download the lua-5.3.6.tar.gz

And then use the terminal:

$cd lua-5.3.6/src

$make macosx

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

After execute:

$sudo cp lua /usr/bin/lua

You can run the lua

0

The download url show below. http://www.lua.org/download.html

lua-5.3.1.tar.gz 2015-06-10, 276K

Zgpeace
  • 3,927
  • 33
  • 31
0

You don't "install" it. It should just be a binary that runs from wherever you extract it to.

If you can't find a binary (there should be one linked somewhere on the Lua site) then just follow the instructions to build it from source.

Ah, here are the binaries: http://luabinaries.sourceforge.net/download.html

You'll probably want the file labelled "MacOS X Intel Executables"

SpliFF
  • 38,186
  • 16
  • 91
  • 120