23

On FreeBSD/Linux, it is possible to restart network services by restarting a daemon.

Is there something similar in macOS Sierra?

3 Answers 3

20

You can tear down and start up the network interface using:

sudo ifconfig en0 down
sudo ifconfig en0 up
13

Network interfaces can also be Disabled & Enabled in System Preferences‑Network.

Make Service Inactive

12

The restarts Wi-Fi without sudo. Does anyone know how to do this with a single command?

networksetup -setairportpower en0 off
networksetup -setairportpower en0 on
2
  • 1
    Create a shell script with those two lines, or use Automator to create an application from a shell script with those two lines. I just did the latter, seems to work fine.
    – Magnus
    Jun 21, 2018 at 11:26
  • 3
    You can perhaps use && like so: networksetup -setairportpower en0 off && networksetup -setairportpower en0 on for single command.
    – Atul Yadav
    Mar 26, 2019 at 12:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .