How to kill the “accept incoming connections” dialogue on your Mac forever
Have you ever come across the above dialogue, asking if you’d like to “accept incoming network connections” on your Mac? It’s caused by the Firewall and it’s meant to be helpful. Because if you have an app that needs incoming network connections all the time, you can just add them to the Firewall rules (under System Preferences – Security – Firewall).
But of course, it doesn’t always work. Some apps get updated and this message starts appearing out of the blue, no matter if it hasn’t happened before or if you’ve manually added said app to the Firewall rules a thousand times already. God only knows whatever is upsetting our precious operating system, but it’s driving us all nuts.
Help is at hand: turns out these messages are caused by some certificate issue I genuinely do not care to know about – nor should I have to. Here’s a “relatively easy” way to fix it once and for all. There are other ways which involve more typing, or switching off the Firewall altogether, but the following is by far the quickest option in my opinion:
- open a Finder window and navigate to the app in question (usually in Applications, potentially in a subfolder)
- open a Terminal Session (under Applications – Utilities – Terminal)
- type cd followed by a space
- from the Finder window, drag the folder in which your app resides into the Terminal window
- hit return (this will put you into the same directory as your app)
- type the following scary line of code:
sudo codesign --force --deep --sign - ./YourApp.app
Replace “YourApp.app” with the actual name of the app, including the .app extension. You will be prompted for your password and in a few moments you should see a message such as “replacing existing signature”. With this code your Mac will have created a self-signed ad-hoc certificate, re-signing the app.
Don’t worry if this doesn’t sound English, all it means is that we’re telling the operating system (or rather, Keychain Access) that “the Administrator says it’s OK to trust this app”.
Now launch your app again. Don’t be dismayed when you see that annoying “accept incoming connections” dialogue again – it’ll be the last time. Select “allow” and you’re done with this – hopefully for good. Try it out by closing your app and restart it again. Celebrate about not seeing that message again.
Should this trick not work, leave out the –deep switch, and make sure your file does not have a trailing slash. Oh, and preface any spaces in the file name with a backslash.
Kudos to ahall over on Stack Exchange for this tip! It’s made me a much happier person again 🙂