Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 down vote accepted

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.

share|improve this answer
en0 for me on an MBA. – colllin Nov 19 '13 at 1:29
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.

share|improve this answer
en0 for me on an MBA. But this command was smart enough to figure that out on its own. – colllin Nov 19 '13 at 1:28
I use my Macbook's en1 for Wifi sniffing using wireshark. Somehow I could not use the airport --channel= command to set a 5 GHz channel like 36 or 40, but all the 2.4 GHz channels worked. I had to earlier reboot my Macbook to fix this issue, but the networksetup commands seem to do the job much quicker :) BTW ifconfig down and up did not work in fixing this issue at least for me. Thanks! – Tuxdude Apr 18 '14 at 18:30
d=$(networksetup -listallhardwareports | egrep 'AirPort|Wi-Fi' -A1 | grep -o en.)
[[ "$(networksetup -getairportpower $d)" == *On ]] && val=off || val=on
networksetup -setairportpower $d $val

The device name is en0 on MacBook Airs. The port name was changed from AirPort to Wi-Fi in 10.7.

share|improve this answer

You must log in to answer this question.

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