Set a Static IP Address with networksetup -setmanual

Persistently configure a manual IPv4 address, netmask and gateway for a macOS network service.

macOSconfigurationnetworksetupipMedium risk
Run `sudo networksetup -setmanual <service> <ip> <mask> <router>` to pin a static IP, and `networksetup -setdhcp <service>` to revert.

01Command

Command
$ sudo networksetup -setmanual Wi-Fi 192.168.1.50 255.255.255.0 192.168.1.1
# Verify:
networksetup -getinfo Wi-Fi

02What it does

The macOS way is `networksetup -setmanual`, which writes the same values System Settings stores — unlike `ifconfig`, whose changes vanish on reboot or link renegotiation. Verify with `networksetup -getinfo Wi-Fi`, which prints the current configuration method (Manual or DHCP) and address. The command requires sudo because it alters system-wide network state.

03Risk

RiskMedium risk
!Warning: If you are connected over SSH, double-check the router and mask before applying; an invalid gateway silently breaks routing until you revert.

04Undo

Undo
$ sudo networksetup -setdhcp Wi-Fi

05Sources

Last verified: 2026-09-17 · Category: Network