WiFi connection lost. Reboot required TLDR; It was a hardware issue.

MacBook Pro - Mid 2012 

OS X Mavericks 10.9.3 (and the problem occurs with 10.9.2 as well)

I'm experiencing some severe WiFi issues. Every 20 minutes or so my Macbook loses its WiFi. This happens at several different locations.

When this happens it looks as if I'm still connected, but I'm not. The drop-down menu does not show any networks. If I turn off WiFi I'm unable to turn it back on again, with a few exceptions (though still no functionality). My guess is that when this happens I've already lost my WiFi completely, the computer just hasn't realized it yet.

The shell command airport shows the same behaviour as I'm seeing in the GUI. When I lose the connection, -I gives me AirPort: Off, and if I manage to turn it on, a scan finds nothing.

At the time of the problem, the Console doesn't contain anything relevant.

Rebooting the computer always fixes the issue, temporarily. I'm of course looking for a solution to the actual problem, but avoiding a reboot would be very helpful as well, especially since it might get me close to a solution. I've tried to restart the WiFi in various ways, but nothing but the reboot has any effect.

I found a thread on this subject:

Is there an equivalent command for 'init.d/networking restart' in OS X

but nothing there has worked.

Things I've tried:


ifconfig eth1 down/up
networksetup -setairportpower en1 off/on
adding a new Location in the Network settings with no connection options (such as WiFi, Ethernet, Bluetooth, etc.) and switching to this Location and then back to the default
switching both channels and frequency (40MHz -> 20MHz) on the router, even though I know it's not the router.


One theory is that the network card is starting to fail. If so, how would I determine this? 

Any ideas?

Some technical info:

  Software Versions:
  CoreWLAN: 4.3.3 (433.48)
  CoreWLANKit:  3.3.2 (332.36)
  Menu Extra:   9.3.2 (932.35)
  System Information:   9.0 (900.8)
  IO80211 Family:   6.3 (630.35)
  Diagnostics:  3.0 (300.40)
  AirPort Utility:  6.3.2 (632.3)
  Interfaces:
en1:
  Card Type:    AirPort Extreme  (0x14E4, 0xF5)
  Firmware Version: Broadcom BCM43xx 1.0 (5.106.98.100.22)
  MAC Address:  7c:d1:c3:84:85:c2
  Locale:   ETSI
  Country Code: SE
  Supported PHY Modes:  802.11 a/b/g/n
  Supported Channels:   1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
  Wake On Wireless: Supported
  AirDrop:  Supported
  Status:   Connected


Edit:

New symptom:
Sometimes when I do networksetup -setairportpower en1 on the whole computer freezes.

Edit2:

I did a complete reinstall, with a partial time machine restoration (no network settings, among other things). Nothing's changed.

Edit3:

The problem seems to be related to temperature, which strongly indicates that there's something wrong with the network card. I'm going to replace it.

If you want to check for temperature issues, keep your computer on a cool surface and see if that helps.
You can try to connect without UI

Manually connect to WiFi

Turn On

networksetup -setairportpower en0 on


Find

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport scan


Connect

networksetup -setairportnetwork en0 WIFI_SSID_I_WANT_TO_JOIN WIFI_PASSWORD


If it works it is not the hardware. In that case the Console report would be helpful to find out who is turning your airport off. That is indicated by the fact that rebooting fixes it, so you have a app messing up your Airport.