Problems reconnecting to WiFi if connection is lost

applescriptmonitoringNetworkscriptwifi

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!

Best Answer

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