Configure MAC OSX Network Interface from the Command Line

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"

Confirm that the settings are correct by issuing the getinfo command once more:

networksetup -getinfo "Ethernet"






4 responses to “Configure MAC OSX Network Interface from the Command Line”

  1. Josh Avatar

    Setup DNS servers for a specific interface named “Wi-Fi”:

    networksetup -setdnsservers "Wi-Fi"
  2. Huy Quach Avatar
    Huy Quach

    Thank you, your document help me

  3. […] 네트워크 매개 변수를 볼 수 있습니다. 위에 링크 된 매뉴얼 페이지 외에도 여기에서 사용 예제를 발견했습니다 […]

  4. SiliconTrip Avatar

    how do I create a new interface? Eg I want my loopback device (lo0) to show in network settings. So I can use airplay with the television. There is only wifi internet and I can’t share the internet from wifi to wifi. so I need another interface to share internet from.

Leave a Reply

Your email address will not be published. Required fields are marked *