4

In the area where I live there are frequent power outages for a few seconds. I am connected via a router, which (of course) restarts each time. Unfortunately my Mac (2011 MB Pro) does not automatically reconnect to the WiFi after the router has restarted and I have to manually reselect the network.

Allan's answer below provided a temporary solution by simply trashing the airport preferences. Unfortunately this solution only worked for a short time and now my Macbook won't reconnect again. Does anyone have any further ideas?

I had assumed this was a problem of the router (and maybe it is) and therefore in the original question asked, whether it was possible to have some script or app run in the background that monitors whether WiFi is connected and when it's not it either tries to reconnect or to turn WiFi on and off or something that would ensure that I regain access.

Nonetheless, finding the root of the problem would obviously be preferred. Any help greatly appreciated!

jan
  • 778

2 Answers2

3

The WiFi on your MBP is, by design, supposed to reconnect to known networks automatically without the intervention of the user and/or an automated script.

That said, WiFi issues seem to have been an ongoing issue for Apple: How do I connect my Mac to wifi automatically?

Now, I am assuming that this is a simple home network where you just have to select the network you want to connect to and provided you have the right passphrase or key, you get connected and away you go.

Given that you have a MacBook and it's portable, have you tried different networks - like gone over to a friends or a relatives home and see if the systems exhibit there? If so, then the issue is limited to your MB, and not the router.

Also, does anyone else report having the issue with your router? If not, it will again confirm that the problem is with your MBP and not the router itself.

What you can try: Delete the Airport .plist

To delete the plist file associated to the Airport,

  1. Disable Airport
  2. Delete the plist file; /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
  3. Re-enable airport and select your favorite network again

This will delete ALL connections of the connections in your saved WiFi networks. You will need to save all of the passwords for all the networks that you want to connect to later.


How to get your WiFi Passwords

Before you delete the plist, you will want to make a copy of all your SSID passwords. They are stored in your Keychain.

When you open your Keychain (CommandSpace and type "Keychain" to use Spotlight to open it) you will see a list of saved credentials from websites, to network passwords and of course the one we are interested in, Airport Passwords.

enter image description here

If you right click on the WiFi network you are interested in, you will have the option to "Copy the Password to the Clipboard" (how convenient is that?!?!)

Copy Password

You will be then asked to authenticate 2 times. The first time because OS X will want to "make changes to your computer" and then a second time because it wants access to your "System Keychain"

enter image description here

This will require you to type your user name and password of an Administrator (if that's you, then your username and password).

You can now paste that password anywhere...

enter image description here

Or maybe in a spreadsheet for safekeeping...

enter image description here

Allan
  • 101,432
  • Thank you for your suggestions. My suspicion that it's the router comes from the fact that (a) I haven't had that problem anywhere else (although it might also have been that the connection just was never lost) and (b) that another MacBook connected to the same router also exhibits the same problem (although it's the same model, so it could also be related to that). I'll try if deleting the plist does anything. Before I do that though, if I keep the old plist, will I later be able to swap them again, without having to reenter all passwords? – jan Mar 22 '16 at 00:15
  • Yes, If you save the plist, and it doesn't fix the problem, you can just copy it back the way you had it. Oh...what kind of router is it, do you know? – Allan Mar 22 '16 at 00:19
  • Your suggestion seems to have done the trick! I trashed the plist and then tried restarting the router twice, and each time it connected automatically. Cool, thank you! That was easier than I thought. – jan Mar 22 '16 at 13:05
  • (Oh and the router was a TP-Link TN-WR841N) – jan Mar 22 '16 at 13:06
  • Actually I have one more question, since there were actually some important Airport networks saved, where I'd need to hunt some person down to get the password again. Do you know if there is a way to manually hack the plist to add them? I looked at the plist and saw there are two xml strings: one <key>wifi.ssid and some stuff and then a <dict> array. Do you think I can just copy them into the new plist? – jan Mar 22 '16 at 13:10
  • You can't copy them to a new plist because the passwords are stored in the keychain. I've updated my answer. – Allan Mar 22 '16 at 14:45
  • Unfortunately after one day it went back to its old behavior. Just had a power outage which lasted about 40 seconds and then I waited for over 5 minutes and it didn't reconnect. Neither of the two laptops :( Any further ideas? – jan Mar 23 '16 at 07:03
  • That seems to be normal behavior. Tested it with an iMac, a MBP, and a MS Surface. I killed power to the AP and none would reconnect. Once connected, the device would reconnect to the AP if it became disconnected. – Allan Mar 23 '16 at 12:48
  • Hmm, but you write once connected it would reconnect? So it did reconnect as soon as the network became available again? In my case the problem is it never reconnects after the router has restarted, even if I wait for an hour. And that was temporarily solved after trashing the plist. But a day later again it won't reconnect. Any ideas? – jan Mar 23 '16 at 23:20
  • Test it by turning off wifi and then back on. It should reconnect. Let me know what the result is. – Allan Mar 23 '16 at 23:48
  • Turning wifi off and back on always reconnects (even with the previous plist). Turning the router off and back on it doesn't. After trashing the plist it did reconnect also after turning the router off and back on, but only for a short while. Now after a day of normal use it stopped again. – jan Mar 24 '16 at 01:47
  • Any further suggestions what I might try? – jan Mar 28 '16 at 01:46
  • Were both of the laptops that didn't connect Macs running the same OS? You may have a bad router. Is the router by chance on a UPS (battery backup?) – Allan Mar 28 '16 at 13:42
  • Both running El Capitan, yes, both up to date (also both same model MBPs [late 2011]). Router is not on a UPS. It might be the router but what I was perplexed by that at first your solution seemed to work. I trashed the plist and then disconnected the router and reconnected multiple times and both reconnected without problem. A day later (probably having entered sleep in the meanwhile) they wouldn't reconnect again. (Hence I haven't given up of maybe solving this in a better way than with a script) – jan Mar 29 '16 at 02:42
0

The simple solution I use is an economical UPS to your router which has enough battery power to last through these outages. Better UPSs can also help protect devices from power surges.

  • 1
    This is the worst solution... it's more of a diy, instead of having apple fix it or doing it via some app – Nabeel Khan Jun 05 '18 at 21:23
  • It's even worse than that because it is very likely that internet failure is not related to a power failure. – Rich Dec 08 '18 at 04:38