Prevent a specific app from accessing the Internet

Solution 1:

What you're looking for is called an application firewall. One free/open source program that does this job is called LuLu -- https://objective-see.com/products/lulu.html -- with code on github here.

Edit: some example images of the firewall page itself, which pops up when a program makes a connection attempt:

LuLu application firewall

Rules once made can be configured via an app, which has a UI a bit like this:

Lulu app

Solution 2:

You can use a 3rd party app called Little Snitch to block Internet access for individual apps. Little Snitch comes with a limited 30 days free trial and costs € 45 for single user license thereafter.

Another alternative is Radio Silence, a network monitor and firewall app for macOS. It lets you control Internet access on an individual app basis. Radio Silence comes with a full 30 days trial and costs US$ 9.