Enjoying Open Source Software

Use ERC and ZNC to chat on IRC with Emacs

Chat on IRC with ESR, the Emacs IRC client. Use the ZNC IRC bouncer to stay 24x7 online.

When you boot up your laptop, connect ERC to the bouncer, and get all the messages you missed while you where away.


ERC is a powerful, modular, and extensible IRC client for Emacs.

You don't have to install it, ERC is standard available in GNU Emacs.


ZNC is an IRC network bouncer or BNC. It can detach the client from the actual IRC server, and also from selected channels.

Installing ZNC

I installed ZNC on a FreeBSD jail. This adds a user znc, this will be the admin-user for your znc server.

Make sure ZNC will be started at boot, by adding the line znc_enable="YES" to /etc/rc.conf.

Create a configuration with the following command:

su -m znc -c 'znc -d /usr/local/etc/znc --makeconf'

The path /usr/local/etc/ is typical for FreeBSD, on other OS'es this may be different.

There is no need to let the user znc connect to any IRC network.

Log in on the web admin page (same port as the port you have configured), as user znc with the password you did set.

Now add one or more users.

Setting your user preferences in ZNC

Log in as the just created user on the web admin page, add a network, f.e., "liberachat", and connect this to Libera.Chat. You can also add some channels to attach to.

Supply the NickServ password you have on the network and choose SASL.

To protect your password, and your chats, choose TLS for the connection with your chat network.

Preparing Emacs

(use-package znc
  (setq znc-servers
   '(("" 1234 t
      ((liberachat "zncusername" "zncpassword"))))))

In this example, is the IP address of your ZNC server, 1234 is the port.

The network that you added in the web admin page is here mentioned as liberachat. Change that according to the name you gave your network in the web admin page.

The zncusername and zncpassword are the credentials you added as the user znc when adding users.

Using ERC

Start with M-x znc-erc.

Use C-x b to go to the buffer of a channel you are connected to. Otherwise go to the buffer of the network and join a channel.

Some handy key bindings:

  • C-c C-b (erc-switch-to-buffer)
  • C-c C-u (erc-kill-input) (Kill the current input line)
  • C-c C-u (erc-kill-input)
  • C-c C-j (erc-join-channel) Join channel. If point is at the beginning of a channel name, use that as default.
  • C-c C-q (erc-quit-server) Disconnect from current server

See also the friendly manual.


⇽ Using org-attach in Emacs org-mode Moving from Pleroma to Honk ⇾