Let me make my question more specific. I'd like to be able to enable/disable built-in/external network adapter(ethernet or Wi-Fi), built-in/external bluetooth adapter, etc. Is there any general method to deal with individual hardware just like Windows? Thanks!
On the networking front, it depends on what you mean by “disable”:
If want to prevent the hardware from showing up at all, you may be able to do that at the I/O Kit level. The typical approach is to create an I/O Kit driver that matches against the hardware more tightly than the built-in drivers, and then explicitly avoids publishing a network interface.
If you want to disabling the resulting network interface, you can do that using the System Configuration framework.
Both approaches have present significant challenges.
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"