7

How can I block internet access to a specific application in Mac OS X? I need this to be done from the command line and hopefully use the ipfw terminal command.

Specifically I am looking to toggle the internet connection on and off in the iPhone simulator application since there is no airplane mode.

1
  • If you want something cheaper and and simpler than Little Snitch, take a look at Radio Silence: radiosilenceapp.com. Still not command line based, though. :( Commented Apr 10, 2019 at 16:18

3 Answers 3

6

You can use the Lulu open-source macOS firewall that aims to block unknown outgoing connections, unless explicitly approved by the user. Whilst it has a GUI, the set of blocked applications can be controlled via the command line by modifying the config file /Library/Objective-See/LuLu/rules.plist as explained in the Lulu webpage (near the bottom).

1
  • Can Lulu able to block websites as well?
    – alper
    Commented Oct 20, 2022 at 14:06
4

I don't have a command line solution to do so, but there is an application that can successfully do exactly what you want.

Little Snitch is an application that has the ability to block certain processes and monitor connections. You could use this to block the iPhone simulator process from any network connectivity which would achieve the same effects as airplane mode, minus the native airplane mode features such as "You must turn on Airplane mode to use this feature", but so will a terminal command.

Hope this helps a little and good luck with developing your app! :)

4
  • 1
    I have definitely seen the Little Snitch tool before, but don't think it has a command line solution. If a UI solution suited my needs I could just use the Xcode provided Network Link Conditioner. Commented Apr 17, 2014 at 1:00
  • Little snitch doesn't have a command line tool. I personally don't see the difference between using a command line or not where both can achieve the same result. But whatever floats your boat I guess :) Commented Apr 17, 2014 at 1:32
  • Is Little Snitch free to use?
    – alper
    Commented Jul 8 at 14:51
  • It was 10 years ago Commented Jul 8 at 15:37
1

You could also block incoming connections to an application by using the firewall. follow the instructions given below:

https://support.apple.com/en-us/HT201642

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .