How to Reboot Networking on Mac from CLI
If you need to reboot, or restart the networking interface on your Mac, by using the CLI, then you can issue the following commands:
Using the ifconfig
primary interface
Tear down the networking interface
sudo ifconfig en0 down
Restart the networking interface
sudo ifconfig en0 up
Verify the networking restart
ifconfig -u en0
Alternative without sudo
, using networksetup
If you need to perform the same result, but not able to run sudo
, then look to the networksetup
.
Tear down the networking interface
networksetup -setairportpower en0 off
# or
networksetup -setairportpower "Wi-Fi" off
Restart the networking interface
networksetup -setairportpower en0 on
# or
networksetup -setairportpower "Wi-Fi" on
For more information
For more information on the above commands, take a look at the man pages.
man ifconfig
man networksetup