netsh equivalent in OSX In Windows, I enjoy the ability to toggle the "LAN" NIC between a known static IP and DHCP from the command line interface (CLI) via .bat files:

netsh interface ip set address name="LAN" static 192.168.1.88 255.255.255.0 192.168.1.20 1



netsh interface ip set address "LAN" dhcp


What would be the OSX CLI equivalent?   When configuring network devices, I find myself frequently toggling between DHCP &lt;==> Static IP configurations on the CLI.  

There seem to be plenty of examples of performing this task via the GUI, however, this does not lend itself to frequent toggling between DHCP and a target static IP.

The ability to toggle between states from the CLI is convenient.  It may be the pinnacle-of-convenience to invoke a toggle-script to a Safari \ Firefox button.
A netsh counterpart for manipulating network settings would be the networksetup command, but to achieve what you want, the easiest would be to define two separate network locations in GUI, one with static IP, the other one with DHCP. Then execute:

# scselect
Defined sets include: (* == current set)
   02080D27-B377-4942-BB3A-CF0C8F049F9E (static IP)
 * 0F27B96E-9B5A-4FAE-B639-C374BD77C1A6 (DHCP)


Take note of the GUID and execute the following to switch:

# scselect 02080D27-B377-4942-BB3A-CF0C8F049F9E


You can write a more friendly script with grep and sed to suit your taste.