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. 用sharding技术来扩展你的数据库(一)sharding 介绍

    数据库的sharding技术作为一个“新瓶装旧酒”的概念,在新的应用环境中被赋予了新的意义.随着云计算的发展,sharding在最近几年是越来越火热,越来越多的产品开始声称自己支持sharding功能 ...

  2. 【剪枝】HDU 1010——tempter of the bone

    来源:点击打开链接 看上去数据规模很小,但是必须要剪枝,否则直接爆TLE. 通过这个题可以练习奇偶剪枝. 另外:还有一个优化方式,如果所有步数走完了门还没关,则直接返回结果"NO" ...

  3. VS2005配置CPPUnit进行单元測试

    一. 编译CPPUnitproject 1.  解压文件cppunit-1.12.1.tar.gz. 2.  编译$BASE/src/cppunit/CppUnitLibraries.dsw中的cpp ...

  4. ThinkPad E431怎样关闭触摸板

    ThinkPad E431怎样关闭触摸板 系统环境:win 7 旗舰版 1.下载驱动程序 到官方下载UltraNav驱动.參考例如以下图所看到的: Think Pad系列关闭触摸板须要安装专门的驱动程 ...

  5. 导出项目为jar包

  6. java实现window phone推送通知

    package com.windowphone.text; import java.io.IOException;import java.io.OutputStream;import java.net ...

  7. [Node.js] Creating JWTs (JSON Web Tokens) in Node

    In this lesson we will look at all of the pieces that combine together to create a JWT (j AWT) or JS ...

  8. [Javascript] Create an Array concatAll method

    In addition to flat Arrays, programmers must often deal with nested Arrays. For example let's say we ...

  9. RHCA学习笔记:RH442-Unit9内核定时与进程延时

      Unit 9 Kernel Timing and Process Latency 内核定时与进程延时 学习目标: A.了解CPU 是怎样追踪时间的 B.调整CPU的访问次数 C.调整调度延时 D. ...

  10. MySQL主主复制+LVS+Keepalived实现MySQL高可用性

    http://bestvivi.com/2015/09/09/MySQL%E4%B8%BB%E4%B8%BB%E5%A4%8D%E5%88%B6+LVS+Keepalived%E5%AE%9E%E7% ...