如何在 MacOS 上安装 Lua?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5496003/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 07:53:07  来源:igfitidea点击:

How Do I Install Lua on MacOS?

macoslua

提问by Mohammad Fadin

I just downloaded Lua from the official website.

我刚刚从官网下载了Lua。

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

我想在我的 Mac 上安装它,但我不知道如何安装。而且我从来没有尝试过使用 Mac 来安装和使用编译器,然后(xcode,titan,corona)对我来说很容易:)

I tried this linkbut 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

另外是否有关于如何在 mac 上安装和开始使用 Lua 的完整指南?因为我看到的只是窗户:S

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

注意:在我问这个问题之前,我搜索了 SOV,但找不到我的答案。

回答by jemeshsu

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

这个 Wiki 几乎没有列表:http: //lua-users.org/wiki/MacOsxLua

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

如果您使用 Homebrew ( https://brew.sh/),只需输入:

brew update
brew install lua

回答by Prajna

Compiling from source code is not that painful.

从源代码编译并不那么痛苦。

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

Lua 5.1.4 在这里:http://www.lua.org/ftp/lua-5.1.4.tar.gz Lua 5.2 alpha 在这里:http: //www.lua.org/work/lua-5.2.0-阿尔法.tar.gz

Take Lua 5.2 as example:

以 Lua 5.2 为例:

  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)
  1. 打开你的 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(我相信你已经安装了 Xcode)

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

之后,您可以在当前目录下看到“lua”二进制文件。

sudo cp lua /usr/bin/lua

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

现在就可以进入lua试一试了。:)

回答by 0bserver07

If you have brewinstalled, just try:

如果您已经brew安装,请尝试:

brew install lua

brew install lua

回答by Stuart P. Bentley

With MacPorts:

使用MacPorts

sudo port install lua

回答by Stuart P. Bentley

If you have brew, use the following code:

如果有brew,请使用以下代码:

brew update
brew install lua

That works for me.

这对我行得通。

回答by Ajit Surendran

Compile using source on mac

在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.

回答by laka

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

您只需按照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.

应该出现。这意味着 lua 安装正确。

回答by Zgpeace

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

下载地址如下所示。 http://www.lua.org/download.html

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

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

回答by SpliFF

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.

如果您找不到二进制文件(Lua 站点上的某处应该有一个链接),那么只需按照说明从源代码构建它。

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

啊,这里是二进制文件:http: //luabinaries.sourceforge.net/download.html

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

您可能需要标有“MacOS X Intel Executables”的文件