Category Archives: Command line

Command line Mac OS X

How to restart Mac OS X networking with command line

If you’re a terminal fan like me, you’ll occasionally need to reboot the OS X network interface. There’s a quick way to do this through the command line – but first you need to know the identity of your network interface. Sometimes after my laptop wakes up after it was suspended, it lost the wireless signal. I have a repeater then I needed to do either: power off/on the repeater or reboot my laptop. I found if I only restart the networking service is enough.

Run the ifconfig command in your terminal and find the interface with an IP address attached to it. On my MacBook Pro, the ethernet interface is en0 while the wireless interface is en0. Yours may be similar.

Shutting down the network interface

Now that you’ve identified the interface, shutting it down and restarting it is too easy. Run this command:

sudo ifconfig en0 down

And to start things back up again…

sudo ifconfig en0 up

That’s it. It’s a simple command that’s worth remembering – or bookmarking!