Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting two erl shells to talk on OS X

I want to be able to have two Erlang shells to talk. I'm running on OS X.

I tried the tut17 example here.

I've also tried:

$ erl -sname foo

and then in a new Terminal:

$ erl -sname bar

(bar@elife)1> net_adm:ping(foo@elife).
pang

Any ideas?

like image 358
Eli Avatar asked Jan 26 '10 01:01

Eli


2 Answers

It's kind of broken on the mac. By default, the mac can't resolve its own shortname. Your host's name is really probably "elife.local".

If you start erl with -name FQDN, then the pings will work.

ie: you would start it with

$ erl -name [email protected]

this probably could be fixed by making the mac capable of resolving it's own short name

Here's example output from my mac. When I do -sname I get the same result as you.

The first node:

$ erl -name [email protected]
Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
([email protected])1> 

The other node:

$ erl -name [email protected]
Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
([email protected])1> net_adm:ping('[email protected]').
pong
like image 197
David Budworth Avatar answered Sep 28 '22 08:09

David Budworth


A simpler fix might just be editing your /etc/hosts file and make sure you have something like this line:

127.0.0.1 localhost elife

My mac works fine with shortnames, and I believe this is what did it.

like image 36
Jacob Avatar answered Sep 28 '22 07:09

Jacob