luarocks是基于lua开发的一个包管理工具,所以在安装luarocks之前需要先安装lua(见博客同目录下“lua在MacOS系统上的安装”)。具体的安装步骤如下:

1.源码安装部署luarocks

其实除了源码安装,我们还有其他可以选择的安装方法,比如brew,apt-get,yum等,这里选择源码安装:

$ wget http://luarocks.org/releases/luarocks-2.2.2.tar.gz
$ tar zxvf luarocks-2.2..tar.gz
$ cd luarocks-2.2.
$ ./configure sudo make bootstrap
$ sudo luarocks install luasocket
$ lua
> require "socket"

注:上面的命令是官网的文档里的,与百度到的博客不一致。经实际操作,官网上的可以完美安装,现有博客上的不行。

输出的结果如下:

zfydeMacBook-Pro:luarocks-2.2. zfy$ ./configure --help
Configure LuaRocks. --help This help.
--prefix=DIR Prefix where LuaRocks should be installed.
Default is /usr/local
--sysconfdir=DIR Location where the config file should be installed.
Default is $PREFIX/etc/luarocks Where to install files installed by rocks, to make the accessible to Lua and
your $PATH. Beware of clashes between files installed by LuaRocks and by your
system's package manager. --rocks-tree=DIR Root of the local tree of installed rocks.
Default is $PREFIX --lua-version=VERSION Use specific Lua version: 5.1, 5.2, or 5.3
Default is "5.1"
--lua-suffix=SUFFIX Versioning suffix to use in Lua filenames.
Default is "" (lua...)
--with-lua=PREFIX Use Lua from given prefix.
Default is auto-detected (the parent directory of $LUA_BINDIR).
--with-lua-bin=DIR You can also specify Lua's bin dir.
Default is the directory of the auto-detected Lua interpreter,
or $LUA_DIR/bin if --with-lua is used.
--with-lua-include=DIR You can also specify Lua's includes dir.
Default is $LUA_DIR/include
--with-lua-lib=DIR You can also specify Lua's libraries dir.
Default is $LUA_DIR/lib
--with-downloader=TOOL Which tool to use as a downloader.
Valid options are: curl, wget.
Default is to auto-detect.
--with-md5-checker=TOOL Which tool to use as a downloader.
Valid options are: md5sum, openssl
Default is to auto-detect.
--versioned-rocks-dir Use a versioned rocks dir, such as
$PREFIX/lib/luarocks/rocks-5.1/.
Default is to auto-detect the necessity.
--force-config Use a single config location. Do not use the
$LUAROCKS_CONFIG variable or the user's home
directory. Useful to avoid conflicts when LuaRocks
is embedded within an application.

这里我们主要关注--prefix = DIR 和 --with-lua = PREFIX.

2.设置--prefix和--with-lua

--prefix 设置 Luarocks 安装路径,--with-lua 指定 Luarocks 依赖的 Lua 安装路径。

设置 prefix 会自动将 Luarocks 以及往后使用 Luarocks 安装的 Lua 包,LuaC 包都安装到 Luarocks 安装路径下的相应位置,否则相关的包文件散落在文件系统中,显得杂乱不便于管理,如果所安装的 Lua 模板包含 bin 文件,则会自动安装到此目录下的 bin 路径,与 Luarocks 可执行文件同一路径,更便于管理、使用。


./configure --prefix=/usr/local/luarocks-2.2.2 --with-lua=/Users/zfy/Downloads/lua-5.3.3//我电脑上luarocks和lua的相应版本

//--prefix和--with-lua这两个变量的值取决于你电脑上luarocks和lua的位置,一般来说luarocks的位置是固定的/usr/local/luarocks-2.2.2,但是lua在安装的时候路径各不相同,比如说我的在/Users/zfy/Downloads下。所以请务必先确定上述两者的位置,不要一味照搬。

make build
make install

3.运行

直接在命令行运行luarocks即可。

关于luarocks的用法可查看github上的说明文档,时间有限,本文暂时不翻译了。

luarocks在macOS系统上的安装的更多相关文章

  1. lua在MacOS系统上的安装方法

    lua是一种非常小巧的脚本语言,由标准C编写而成,可以很方便的调用c/c++或者被c/c++.另外相关的还有一个luaJIT,是lua在某些平台上的编译器. 我们在这里只安装lua. 1.检测电脑上是 ...

  2. Oracle 支持在具有 DHCP 分配的 IP 地址的系统上进行安装

    今天在安装Oracle 10g的时候,遇到了“ Oracle 支持在具有 DHCP 分配的 IP 地址的系统上进行安装” 这个问题,经过搜索,找到了解决方案,具体如下: win7下右键单机" ...

  3. 在64位系统上不能安装Matlab notebook的解决方案

    在64位系统上不能安装Matlab notebook的解决方案 过程分解 第一步:安装好matlab(附:Matalab R2015a界面) 第二步:在matlab中执行命令 >>note ...

  4. Kubernetes+Docker的云平台在CentOS7系统上的安装

    Kubernetes+Docker的云平台在CentOS7系统上的安装 1.运行VirtualBox5. 2.安装CentOS7系统. 注意:选择Basic Server类型 安装过程略. 3.修改计 ...

  5. Python3: Windows系统上同时安装Python2和Python3

    Python3: Windows系统上同时安装Python2和Python3 为什么要同时安装Python2和Python3环境呢? 因为一些库只支持Python2或者Python3; 在同一台电脑上 ...

  6. CentOS 6.4 系统上如何安装 tomcat 8

    CentOS 6.4 系统上如何安装 tomcat 8 本文将详细讲解在Linux系统上如何安装tomcat,tomcat是没有32位和64位之分的. 1.下载tomcat 首先我们肯定要先下载tom ...

  7. Macos系统编译percona及部分函数在Macos系统上运算差异

    欢迎来到 GreatSQL社区分享的MySQL技术文章,如有疑问或想学习的内容,可以在下方评论区留言,看到后会进行解答 本文来源:原创投稿 GreatSQL社区原创内容未经授权不得随意使用,转载请联系 ...

  8. openssh 在32位、64位操作系统上的安装配置

    openssh是安装在windows系统上的提供SSH服务的服务端软件,可以提供安全的命令行远程连接管理.下面介绍下openssh成功安装使用的操作步骤. 工具/原料   openssh window ...

  9. MacOS系统下简单安装以及配置MongoDB数据库(一)

    最近写了一个用node来操作MongoDB完成增.删.改.查.排序.分页功能的示例,并且已经放在了服务器上地址:http://39.105.32.180:3333. 项目一共四部分: 1.MacOS下 ...

随机推荐

  1. easyui valid

    /** * 包含easyui的扩展和常用的方法 * * @author * * @version 20120806 */ var wjc = $.extend({}, wjc);/* 定义全局对象,类 ...

  2. 适合高级Java程序员看的12本书

    1.Thinking in Java 2.Head First Java 3.Java in a Nutshell 4.The elements of Java style 5.Effective J ...

  3. ubuntu12.04已安装SQLite3 而简单易用

    今天想写一点app,使用数据库,所以在这里简要地记住它是安装和使用. 1.安装SQLite3 命令行下输入:sudo apt-get install sqlite3 2.安装SQLite3编译须要的工 ...

  4. [欧拉] poj 2230 Watchcow

    主题链接: http://poj.org/problem? id=2230 Watchcow Time Limit: 3000MS   Memory Limit: 65536K Total Submi ...

  5. NotificationListenerService不能监听到通知

    作者:Hugo链接:https://www.zhihu.com/question/33540416/answer/113706620来源:知乎著作权归作者所有,转载请联系作者获得授权. 背景知识: 所 ...

  6. 无法从“object”转换为“string”

    就我在项目中遇到的问题,和大家分享一下“无法从“object”转换为“string” 在把我出错的代码复制上来,  Guid userid = new Guid(Membership.GetUser( ...

  7. 关于Java安全的书

    关于Java安全的书http://automationqa.com/forum.php?mod=viewthread&tid=2831&fromuid=21

  8. 运用json-lib生成特定json

    在实现接口过程中,一般协议都是定义数据格式为json.我们有时候需要把bean转换为JSON输出给接口调用者,但是可能存在bean中的字段有些不是接口定义所需要的.这个时候需要我们对JSON转换是需要 ...

  9. javascript-03

    1.Object   |-1.var  变量=new Object();         |-变量.自定义的属性='值';     |-变量.自定义名称=function(){}   |-2.var ...

  10. ActionBar功能,效果图一览

    这里提供了效果预览,如果由你需要的界面,详细的代码可以去看原文. http://blog.csdn.net/android2me/article/details/8874846 一.概述 1.App ...