2011年10月4日

在 Mac OS X 安裝 RabbitMQ / Erlang

使用 MacPorts 可以輕鬆地在 Mac OS X 安裝 RabbitMQ 及 Erlang 軟體,如果順利的話 : )

會寫這篇網誌記錄的原因,就是過程並不如預期的順利。

如果你的 Mac 還沒安裝 MacPorts ,請先參考以下這篇教學:

http://blog.lyhdev.com/2011/09/macports-mac-os-x-open-source.html

自從安裝了 MacPorts ,我開始把原本在 Ubuntu Linux 常用的開發工具,一個接一個移到 Mac 筆電上面。我盡可能讓自己開發的軟體,可以同時在 Ubuntu Linux 及 Mac OS X 兩套系統上正常運作,有了 MacPorts 的幫忙,原本 apt-get install 一行搞定的事情,也能用 port install 一行解決。

但昨天踢到鐵板了!

我只是想在 Mac 安裝 RabbitMQ :

sudo port install rabbitmq-server

這道指令執行並沒有成功,因為 RabbitMQ 是用 Erlang 開發,所以 port 會先安裝 erlang ,可是就在 erlang 安裝過程中,整個程序 hang 住了,等了很久沒反應、處理器也沒在運作。

若要找出安裝過程出現什麼問題,可以用 -d 參數:

sudo port -d install erlang

找到兇手了,就是這行 Error 訊息。
erlc -W +debug_info +inline -o../ebin hipe_rtl.erl
(no error logger present) error: "Error in process <0.1.0> with exit value: {{badfun,[<<5 bytes>>,<<142 bytes>>,<<9 bytes>>,<<3 bytes>>,<<2 bytes>>,<<5 bytes>>,<<14 bytes>>,<<2 bytes>>,<<8 bytes>>,<<8 bytes>>,<<5 bytes>>,<<7 bytes>>,<<5 bytes>>,<<11 bytes>>,<<2 bytes>>,<<11 bytes>>,<<15 bytes>>,<<4 bytes>>,<<145 bytes>>,<<5 bytes>>,<<1 byte>>,<<7 bytes>>,<<10 bytes>>,<<7 bytes>>,<<6 bytes>>,<<7 bytes>>,<<7 bytes>>,<<6 bytes>>,<<12 bytes>>]},[{erlang,apply,2}]}\n"


根據 MacPorts Trac 的記錄,似乎是 Mac 10.6 + XCode 4 的 gcc 版本會出包。還好熱心的社群朋友已經提供 Patch,服用方法如下:

wget http://trac.macports.org/raw-attachment/ticket/30516/Portfile.patch
sudo patch $(port file erlang) Portfile.patch
sudo port install erlang

之後再執行一次 Erlang 及 RabbitMQ 的安裝:

sudo port install erlang
sudo port install rabbitmq-server

啟動 RabbitMQ 服務:

sudo rabbitmq-server

圓滿!

1 則留言:

  1. Thank you very much! I have only one comment :)! in my case the port file erlang and the patch command was be: "sudo patch /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/erlang/Portfile Portfile.patch" , thank you for you post! ;)

    回覆刪除

lyhcode by lyhcode
歡迎轉載,請務必註明出處!