How can I reset network (Airport) connections from the command line?
I have this MacBook Pro that has intermittent problems connecting to my WiFi network. Sometimes it helps to disable/re-enable Airport and sometimes I have to restart the computer to get my network running again.
Has anyone else experienced this? Are there any commands I can run that would do the same as I do when I restart the computer (short of actually restarting it, obviously) - or at least a command that restarts the Airport service?
Next time, try this from the command line:
sudo ifconfig en1 down
sudo ifconfig en1 up
This should bring your wireless interface down and then bring it back up.
networksetup -setairportpower en1 off
networksetup -setairportpower en1 on
These are the commands I use to control Airport without the menubar icon. The advantage is that they don't require su
/sudo
privileges.