To enable or disable a Network Interface Card (NIC), which essentially refers to your network interfaces like Wi-Fi, Ethernet, etc., on a macOS system, you’d typically be interacting with the network service corresponding to that interface. Here’s how you can do this using both the GUI and the command line:
1. Using System Preferences (GUI):
To Disable:
- Click on the Apple icon in the top-left corner and choose
System Preferences
. - Go to
Network
. - On the left sidebar, select the network service (e.g., Wi-Fi or Ethernet) you want to disable.
- Click on the
Turn off
button orDisconnect
button at the bottom left of the window. - Optionally, if you want to remove this service permanently (not just disable), click on the minus (
-
) button at the bottom of the service list.
To Enable:
- Follow steps 1-3 from above.
- Click on the
Turn on
button orConnect
button at the bottom left of the window.
2. Using Terminal (Command Line):
To Disable:
sudo networksetup -setnetworkserviceenabled <service-name> off
Replace <service-name>
with the name of the network service you wish to disable, like Wi-Fi
or Ethernet
.
To Enable:
sudo networksetup -setnetworkserviceenabled <service-name> on
Replace <service-name>
with the name of the network service you wish to enable.
Tip: To see a list of all network services, you can use the command:
networksetup -listallnetworkservices
Remember, disabling a NIC or network service will disconnect you from the network. If you’re remotely accessing a machine or relying on a network connection for some task, use caution to ensure you don’t interrupt essential services or tasks.