Install ejabberd on macOS using Homebrew package manager

Homebrew is now the de facto package manager for open source software on macOS. Thus, we have discontinued our macOS binary installer to focus on improving further ejabberd experience on macOS by polishing Homebrew ejabberd package.

ejabberd Homebrew

We recently updated ejabberd on Homebrew and we will keep it in sync with ejabberd official releases. As of today, if you install ejabberd with Homebrew, you will always get the latest release.

If you have any suggestion on how to make ejabberd with Homebrew experience better, please open a Github issues, with the tag Packaging:Homebrew.

We have not yet tested it with Homebrew on Linux or on WSL, but still, pleae submit issues if you find some.

Here is the cheat sheet regarding ejabberd management with Homebrew.

Installing ejabberd

The following command will install ejabberd and its dependencies:

$ brew install ejabberd

Starting ejabberd and launching it on macOS start

brew services start ejabberd

Starting ejabberd

Alternatively, the following command start ejabberd in background, with trying to restart it automatically after reboot:

$ /usr/local/sbin/ejabberdctl start

You can check the status with the command:

$ /usr/local/sbin/ejabberdctl status
The node ejabberd@localhost is started with status: started
ejabberd 20.01 is running in that node

If ejabberd is not running the status command will display a nodedown error:

$ /usr/local/sbin/ejabberdctl status
Failed RPC connection to the node ejabberd@localhost: nodedown

Commands to start an ejabberd node:
  start      Start an ejabberd node in server mode
  debug      Attach an interactive Erlang shell to a running ejabberd node
  iexdebug   Attach an interactive Elixir shell to a running ejabberd node
  live       Start an ejabberd node in live (interactive) mode
  iexlive    Start an ejabberd node in live (interactive) mode, within an Elixir shell
  foreground Start an ejabberd node in server mode (attached)

Optional parameters when starting an ejabberd node:
  --config-dir dir   Config ejabberd:    /usr/local/etc/ejabberd
  --config file      Config ejabberd:    /usr/local/etc/ejabberd/ejabberd.yml
  --ctl-config file  Config ejabberdctl: /usr/local/etc/ejabberd/ejabberdctl.cfg
  --logs dir         Directory for logs: /usr/local/var/log/ejabberd
  --spool dir        Database spool dir: /usr/local/var/lib/ejabberd
  --node nodename    ejabberd node name: ejabberd@localhost

Stopping ejabberd

/usr/local/sbin/ejabberdctl stop

Configuration file

To change the configuration file, you can edit /usr/local/etc/ejabberd/ejabberd.yml

If you have upgraded ejabberd and want to apply possible change to config file, you can check the new ejabberd.yml default file ejabberd.yml-new in the same directory.

Checking the logs

To troubleshoot ejabberd, you can check the logs in the directory /usr/local/var/log/ejabberd/


Let us know what you think 💬


12 thoughts on “Install ejabberd on macOS using Homebrew package manager

  1. Hello
    I tried installing Ejabberd by Home-brew and it was installed successfully
    But I couldn’t access web admin page, and it turned out the that this is a bug in Ejabberd 20.02 and it was fixed in the new version 20.03.
    The problem is that Home-brew is not installing the latest version and when I hit: brew upgrade Ejabberd, it shows this message “Warning: ejabberd 20.02 already installed”.
    Can you please make the new version available in Home-brew.
    Thank you.

  2. I tried to install ejabberd in my local mac os machine to create an XMPP demo of my app.
    Follow the above steps, but while checking status or using it to register user, it always throws following error –
    $ /usr/local/sbin/ejabberdctl status
    Failed RPC connection to the node ejabberd@localhost: nodedown

    And if I tries to start or restart it.
    $ brew services restart ejabberd
    Stopping `ejabberd`… (might take a while)
    ==> Successfully stopped `ejabberd` (label: homebrew.mxcl.ejabberd)
    ==> Successfully started `ejabberd` (label: homebrew.mxcl.ejabberd)

    • Like it says in the article, please first check the logs at /usr/local/var/log/ejabberd/: especially ejabberd.log and error.log. Do you see any error messages there?

    • I did not try brew service recently, but try starting ejabberd with ejabberdctl. Possibly, you are not getting access to the same Erlang cookie when run using a service.

  3. 2020-07-23 22:33:04.088897+08:00 [info] @ejabberd_config:load/1:82 Loading configuration from /usr/local/etc/ejabberd/ejabberd.yml
    2020-07-23 22:33:04.670737+08:00 [info] @ejabberd_config:load/1:89 Configuration loaded successfully
    2020-07-23 22:33:05.119397+08:00 [info] @gen_mod:start_modules/0:130 Loading modules for localhost
    2020-07-23 22:33:05.165502+08:00 [warning] @mod_mam:start/2:98 Mnesia backend for mod_mam is not recommended: it’s limited to 2GB and often gets corrupted when reaching this limit. SQL backend is recommended. Namely, for small servers SQLite is a preferred choice because it’s very easy to configure.
    2020-07-23 22:33:05.389915+08:00 [info] @mod_mqtt:init_topic_cache/2:611 Building MQTT cache for localhost, this may take a while
    2020-07-23 22:33:05.397881+08:00 [error] @ejabberd_listener:report_socket_error/3:448 Failed to open socket at 0.0.0.192:7777 for mod_proxy65_stream: can’t assign requested address
    2020-07-23 22:33:05.398310+08:00 [critical] @gen_mod:start_module/4:169 Failed to start module mod_proxy65:
    {error,
    {eaddrnotavail,
    {child,undefined,
    {7777,{0,0,0,192},tcp},
    {ejabberd_listener,start,
    [{7777,{0,0,0,192},tcp},
    mod_proxy65_stream,
    #{accept_interval => 0,access => local,
    auth_type => anonymous,backlog => 5,
    host => <>,hostname => undefined,
    hosts => [],
    ip => {0,0,0,192},
    max_connections => 5,name => <>,
    port => 7777,ram_db_type => mnesia,recbuf => 65536,
    server_host => <>,shaper => none,
    sndbuf => 65536,supervisor => true,transport => tcp,
    use_proxy_protocol => false,vcard => undefined}]},
    transient,brutal_kill,worker,
    [ejabberd_listener]}}}
    2020-07-23 22:33:05.398547+08:00 [critical] @gen_mod:maybe_halt_ejabberd/0:256 ejabberd initialization was aborted because a module start failed.

    • It means you cannot listen on port 7777, possibly because you already have something running there.

  4. Make sure you have install GCC on your mac. I was having the same error but when I have to install GCC everything works fine for me.

    • Strange, as I did not had to install gcc. Which error do you think solves ?
      The eaddrnotavail is an I/O error, not a compilation error.

Leave a Comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.