So this is quite strange and I'm not sure how solvable this will be. But yesterday erc was working just fine, and then today it is stuck on trying to connect to the server (irc.freenode.net) with the error of:

Connection failed!  Re-establishing connection...
*** ERC terminated: failed with code 22

I can't find any way to figure out what "code 22" means. I'm on a Mac 10.11.6 (El Capitan), installed emacs through brew, and ran emacs like so: emacs --no-init-file. I've also uninstalled/reinstalled by deleting both the ~/Library/Caches/Homebrew/emac* and /usr/local/Cellar/emacs.

Lastly during a fresh reinstall of running emacs --no-init-file I also tried to run both M-x erc, M-x irc (in emacs), and M-x erc-tls all fail to connect. I have also tried different ports 6667-7000 any help is appreciated, and thank you.

  • Is this an Emacs question? I would strongly suspect that "any other irc client" includes non-Emacs irc clients, and that your problem is one of general network connectivity to the IRC server(s) you're attempting to contact. Please confirm, and if it's not about Emacs we can close this question.
    – phils
    Apr 11, 2017 at 23:29
  • 1
    Sorry, meant irc clients within emacs my out of emacs client (Colloquy) is working just fine. Edited my title to fit that.
    – Greth
    Apr 11, 2017 at 23:55
  • 1
    Hey I suppose I'll just answer this for anyone out there: I found out it was because of my network. I didn't think this was the case only because I could still connect to other things (like the melpa package in emacs) but after reseting my wifi from regular to bridge mode everything seems to have worked out. Sorry for the misleading question.
    – Greth
    Apr 21, 2017 at 0:43

1 Answer 1


So what I found out was, it was in fact because of my network/wifi port. I didn't think it was at the time only because I could still connect to things over the internet through emacs (i.e. package-refresh-contents for melpa), and I could still connect to the internet normally/connect to irc using other applications.

The wifi error I got was: Double NAT and to fix it I changed my wifi (using Apple's AirPort Utility app) from Network -> Router Mode -> DHCP and NAT to Network -> Router Mode -> off (Bridge Mode). From there erc worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.