您的位置:首页 > 其它

Mac OS X 搭建erlang开发环境

2015-03-08 00:47 519 查看

一、erlang源码包下载

到elang官网下载.tar.gz文件,下载地址为:http://www.erlang.org/download.html

这里使用的是17.4版本

二、得到otp_src_17.4.tar.gz源码包并解压安装

进入下载目录
执行解压命令:tar -zxvf otp_src_17.4.tar.gz 
cd到解压之后的目录:cd otp_src_17.4

执行./configure ,如果出现以下问题:
Ignoring the --cache-file argument since it can cause the system to be erroneously configured
Disabling caching
checking build system type... i386-apple-darwin14.1.0
checking host system type... i386-apple-darwin14.1.0
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
这时候就需要检查config.log文件,看到下面的这句话:
You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.
configure:2210: $? = 69
configure: failed program was:
| /* confdefs.h.  */
表明自己安装的Xcode从来没有运行过,这时候需要运行一次.点击同意协议之后,Xcode会安装一些组件。安装完之后就可以使用./configure指令了。

接下来执行make指令,一直等它执行完......。

最后一步执行sudo make install指令,最后打印出了以下几步,表明安装已经完成。
ln -s ../lib/erlang/bin/erl erl
ln -s ../lib/erlang/bin/erlc erlc
ln -s ../lib/erlang/bin/epmd epmd
ln -s ../lib/erlang/bin/run_erl run_erl
ln -s ../lib/erlang/bin/to_erl to_erl
ln -s ../lib/erlang/bin/dialyzer dialyzer
ln -s ../lib/erlang/bin/typer typer
ln -s ../lib/erlang/bin/escript escript
ln -s ../lib/erlang/bin/ct_run ct_run
注:以上在安装过程中出现的警告信息可直接忽略。

三、检查安装是否成功

在bash环境下输入erl指令出现:
Erlang/OTP 17 [erts-6.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.3  (abort with ^G)
1>
恭喜你!erlang环境已经搭建成功。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息