Mac OS X firewall rules to block UDP connection to an external server

MacOS has a firewall ported from OpenBSD — Pf. Although it's not kept up to date it still can be used for such a simple task you have.

Typically Pf isn't enabled by default, but ruleset crafted by Apple is loaded from /etc/pf.conf. It's not anything complex but rather a frame to be used later by some components of the OS.

For quick tinkering though you can simply load your own ruleset and enable Pf at the same time: sudo pfctl -ef …filename…

If you're looking for persistent solution instead, check out tutorials widely available on that subject all over the Internet.

Manuals are shipped with MacOS: man pfctl, man pf.conf