说明:rebar分为两个版本:rebar与rebar3。第一种介绍使用源码安装rebar3,第二种介绍使用brew安装rebar
一、Mac OS Install Rebar3
- 1.下载源码:
$ git clone https://github.com/erlang/rebar3.git
终端打印信息:
mac-2:Erlang julong$ git clone https://github.com/erlang/rebar3.git
Cloning into 'rebar3'...
remote: Enumerating objects: 56, done.
remote: Counting objects: 100% (56/56), done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 18993 (delta 24), reused 30 (delta 10), pack-reused 18937
Receiving objects: 100% (18993/18993), 5.55 MiB | 432.00 KiB/s, done.
Resolving deltas: 100% (13004/13004), done.
- 进入到rebar3目录下:
cd rebar3/
- 执行下面命令:
./bootstrap
终端打印信息:
===> Verifying dependencies...
===> Fetching bbmustache ({pkg,<<"bbmustache">>,<<"1.6.1">>})
===> Version cached at
...
===> Linking _build/default/lib/bbmustache to _build/bootstrap/lib/bbmustache
===> Linking _build/default/lib/certifi to _build/bootstrap/lib/certifi
===> Compiling rebar
===> Building escript...
- 安装:
./rebar3 local install
终端打印信息:
===> Extracting rebar3 libs to /Users/julong/.cache/rebar3/lib...
===> Writing rebar3 run script /Users/julong/.cache/rebar3/bin/rebar3...
===> Add to $PATH for use: export PATH=/Users/julong/.cache/rebar3/bin:$PATH
- 复制到bin目录下,方便以后调用:
cp rebar3 /usr/local/bin/
- 6 测试:终端执行下面命令:
rebar3 -v
二、Mac os install Rebar
- 打开终端执行以下操作
brew install rebar
如未安装brew,请参考→https://www.jianshu.com/p/19e4127a71c3