Everytime I lock my mac and log back in two minutes, It has disconnected the wi-fi network. Is there a setting to disable this?

Model: Mac Book Pro - 15-inch, Mid 2010 I lock it by clicking 'Login Window...' after clicking my username on top right corner of the menu bar.


Do the following:

Find out what the network interface is for your wifi. Mine is "en1" for this example (I have obfuscated my MAC addresses with "00")

ether 00:00:00:00:00:00  
inet6 0000::000:0000:0000:0000%en1 prefixlen 64 scopeid 0x5
inet netmask 0xffffff00 broadcast
media: autoselect
status: active

Then, you need to set up the airport util for your wireless card to tell it not to shut off:

cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
sudo ./airport en1 prefs DisconnectOnLogout=NO
  • 1
    I really don't know why this isn't the accepted answer, this was exactly the problem I was having. Thanks! – NateDSaint Oct 10 '13 at 15:35
  • 10
    This didn't work on my 2013 MBPr, unfortunately. – gWaldo May 8 '14 at 18:38
  • 2
    Didn't work on late 2013 MBPr. – Johann Jul 21 '14 at 18:32
  • 4
    what if it's not a wireless card? (ethernet via thunderbolt). What would be the path? – nute Mar 8 '15 at 15:02
  • 5
    (for followers, command control power is "reboot" so don't do that. If you don't have an eject button, "lock screen" shortcut is ctrl+shift+power) – rogerdpack Oct 22 '15 at 18:30

EDIT: Please see John's answer above, which basically says to open Terminal and run:

cd /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources
sudo ./airport en1 prefs DisconnectOnLogout=NO

where en1 is the name of your Mac's WiFi interface. You can get it with this Terminal command:

ifconfig | grep -B 6 'status: active' | head -n 1 | cut -d : -f 1

when WiFi is the only active interface (that is, no Ethernet cable attached).

To list the interface settings, run in Terminal:

./airport en1 prefs

Typical output is:

AirPort preferences for en1:

Unable to retrieve JoinMode

Other people's Macs are misbehaving in a similar way, read for example this and this. Although I own a similar MacBook Pro that runs 10.8.2 I can count myself fortunate not to suffer this issue.

Consequently the list below is rather a compilation of possible fixes (some may even seem absurd or just plain obvious) than tested recommendations:

I checked the power management settings (command pmset) and defaults but couldn't find anything.

(My setup is: clean "Mountain Lion" install (with restore from Time Machine) and Airport Express base station.)

Hope this will help...

  • One comment, most third party programs only lock the main screen - if you have a second monitor, or someone can attach one, they're useless. – Michael Kupietz Feb 22 '17 at 5:32
  • Changing the preferences via airport in the terminal did not resolve this issue for my High Sierra 10.13.2 MacBook Pro. – Cory Klein Jan 24 '18 at 19:29

Try the workaround here: http://forums.whirlpool.net.au/archive/2000041

The problem with OS X is to "lock" your screen you have two options, either let the screen saver time out and lock your screen (which doesn't disconnect WIFI) or clicking on your "user name" on the top right corner and choosing "Login Window" which essentially locks your mac and takes you to a login window, however this approach disconnects the WIFI Connection.

The work around I have found is installing an app called "Lock Me Now" from the app store and once it has been installed launch it and from the preferences "check" "Just Lock" under "Lock Type" which does the same thing as the screen saver timing out. Also for ease of use you can assign a keyboard shortcut to simplify the process of locking your Mac (I chose to use Command + L )

  • I realized that my initial problem was actually resolved by this, but the workaround I had built worked better with @John's answer. I'm going back to yours, though, as it makes it easier to lock my desktop and walk away without worrying about everything turning off while I'm gone. : ) Thanks! – NateDSaint Oct 14 '13 at 21:22
  • The problem is, this is a security risk, as it displays your username publicly when you wake it, even if you have your login window set not to. – Michael Kupietz Feb 22 '17 at 5:34

You can do it by writing simple service for Mac, this is best solution for this problem.

Try this out -http://tecride.blogspot.in/2015/04/wifi-disconnects-when-you-lock-osx.html

  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Tetsujin Apr 9 '15 at 13:58
  • 1
    This is the only answer that actually works without requiring the user to completely change his/her workflow. – Mashmagar Dec 8 '15 at 17:38
  • This is the best answer for me (2015 MBP, OS 10.11), though I'm disappointed that I need to learn a new lock shortcut. – Eric Angell Jan 21 '16 at 18:21
  • As I commented above, this will show your username to anyone trying to unlock your Mac, even if you have your login window set not to. That's a security risk. – Michael Kupietz Feb 22 '17 at 5:34

Open Applications > Utilities > Keychain Access then go to Keychain Access in the menu bar on the top, then Preferences - click "show keychain status in the menu bar".

You will see a little lock on the menu bar ... click on it then lock screen from there.

  • I use this all the time, and I still get disconnected from my network. – nute Mar 8 '15 at 15:05
  • 1
    This preference option is not present on my MacBook Pro running High Sierra 10.13.12. – Cory Klein Jan 24 '18 at 19:26

You can live without "lock me now" app.

just use:

CTRL + SHIFT + 'key to eject cd' (or if you don't have an eject key, ctrl+shift+power)

  • what do you mean by "lock me now"? – dwightk Mar 13 '14 at 21:15
  • Pretty sure he means the above mentioned program in the app store. His suggestion does the same thing without having to have an app. – Darrell Golliher Apr 8 '14 at 18:43
  • 4
    Unfortunately this method also drops the network on MBPr's – gWaldo May 8 '14 at 18:38

For OS X 10.9, instead of locking your Mac consider using the following command in terminal:

open -a /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app

The command starts the ScreenSaveEngine.app which locks the screen without disconnecting the Wi-Fi. I am not sure if it works on other versions of OS X.


found a solution for this problem. Seems pretty well documented


  • 1
    Welcome to Ask Different! While this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Glorfindel May 14 '18 at 7:08
  • Links tend to die over time. If [when] that happens your answer will not be very helpful. Please provide the salient points from the link in your answer. Also, how does your answer differ from the nine answers already posted, including the accepted answer? – Greenonline May 14 '18 at 9:42
  • In accepted answer, 1. many comments are there and they told - 'Didn't work on late 2013 MBPr.', So, I didn't try accepted answer 2. I was searching a GUI solution not CLI solution So, this is different solution from another one – Arpit May 14 '18 at 12:58
  • yes, I know stackoverflow rules but in this link, they showed via images and it was difficult to write everything in words. So, I shared link only. – Arpit May 14 '18 at 13:08

For maverick users-

To enabled the "Open Wireless Diagnostics.." as it doesn't show up by default to diagnose the WIFI connection.

Click the wifi icon on the menu bar with the Option key pressed. On the bottom of the list, you have "Open Wireless Diagnostics..."

You must log in to answer this question.

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