Command line network configuration for the MAC is quite a bit different when compared to Linux or Unix. The networksetup command is used instead of ifconfig to configure devices.
The first step is to get a list of all network services – these are really physical and virtual devices, VPNs, etc..
networksetup -listallnetworkservices
The next step is to get the current settings for the network service that you might want to configure – the following example is using the service “Ethernet” and is enclosed in quotes as some of the services have spaces in the names:
networksetup -getinfo "Ethernet"
To configure an interface manually, use something like the following:
networksetup -setmanual "Ethernet" 192.168.1.10 255.255.255.0 192.168.1.1
Confirm that the settings are correct by issuing the getinfo command once more:
networksetup -getinfo "Ethernet"
Leave a Reply