Changing local IP address with networksetup command on OSX?

The command to manually set an IP address is:

networksetup -setmanual Ethernet 192.168.0.6 255.255.255.0 192.168.0.1

This assumes the following:

  • netmask is a /24 (254 hosts)
  • the router/gateway is the "common" 192.168.0.1
  • Your interface is Ethernet

You will need to adjust your settings accordingly. To get a list of network services (interfaces), you can issue the command:

networksetup -listallnetworkservices