#networksetup
25 solutions
networksetup -setairportpower switches the Wi-Fi hardware on or off, the same toggle the Wi-Fi menu performs.
Use networksetup -setairportnetwork to connect your Mac to a Wi-Fi network by name and password without touching the Wi-Fi menu.
List every Wi-Fi network the Mac remembers and delete one so it never auto-joins again.
Disable IPv6 on Wi-Fi or Ethernet with networksetup -setv6off when IPv6 causes connection problems.
networksetup -getinfo summarizes a named network service: IP, subnet mask, router, and configured DNS.
Persistently configure a manual IPv4 address, netmask and gateway for a macOS network service.
networksetup -getairportnetwork prints the SSID the Wi-Fi interface is associated with, right now.
Use networksetup -setdnsservers to set, inspect, or reset DNS servers for any macOS network service.
Read the configured DNS servers for Wi-Fi or Ethernet with networksetup -getdnsservers.
Use networksetup -getinfo to print the full current configuration (IP, subnet, router, DNS) of Wi-Fi or Ethernet.
Configure the macOS web (HTTP) proxy for a network service from the terminal with networksetup -setwebproxy.
Print the hardware (MAC) address of a network service's interface with networksetup -getmacaddress.