How Do I Install Lua on MacOS?
Solution 1
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:
- Open your Terminal.app
- wget http://www.lua.org/work/lua-5.3.0-work3.tar.gz
- tar xvzf lua-5.3.0-work3.tar.gz
- cd lua-5.3.0-work3/src
- 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. :)
Solution 2
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
Solution 3
If you have brew
installed, just try:
brew install lua
Solution 4
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.
Solution 5
With MacPorts:
sudo port install lua
Related videos on Youtube
Comments
-
Mohammad Fadin over 3 years
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.
-
JUST MY correct OPINION about 13 yearsWhen 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.
-
-
Mohammad Fadin about 13 yearsThanks 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
-
lhf about 13 yearsSee also lua.org/faq.html#1.1 Change linux to macosx and after building do
make install
. -
Mohammad Fadin about 13 yearsThanks. I successfully managed to run the compiler. I will get back whenever I have trouble Thanks @lht and @Prajna
-
M.W. Felker over 9 yearsThanks for this, worked! Anyone who wants to know, the lua file you need to copy is found under your current dir /src/lua
-
rafaelmorais over 7 yearsTo make this possible I had to change /usr/bin/lua to /usr/local/bin/lua and it works fine.
-
jknight over 6 yearsEvery 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
-
Dang_Ho over 3 yearsshould copy to /usr/local/bin instead of /usr/bin