My laptop isn't staying connected to it's wireless connection when I lock it. I set up an alias using this post and tried to follow the instructions from this one, and those didn't work for me either. My prefs for en0 (the wireless interface) are as follows:

AirPort preferences for en0:

Unable to retrieve JoinMode

And the alias I use to lock the screen is:

alias lockscreen='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend'

My system info is below as well:

Laptop Details

Any recommendations or any ideas of what I'm doing wrong? I don't believe this is a duplicate of the other question since the answers in there didn't work for me, so any advice would be appreciated.

Edit: Going to my username and clicking Login Window... to lock the screen also disconnects the WiFi.

  • Have you tried re-installing OS X El Capitan from your recovery partition? – Sam Feb 21 '19 at 4:04
  • No I haven't. I figured out an answer to it though so I'll post it. – AndreasKralj Feb 21 '19 at 15:52

All right, so I've figured out a way to do it. I tried using the command pmset displaysleepnow, and it works as intended. The additional thing is that you have to go to System Preferences > Security & Privacy > General and require a password immediately after the computer display goes to sleep. I then set up an alias:

alias lscreen='pmset displaysleepnow'

and it works as intended. I use the terminal a lot, so lscreen is an easy way for me to lock my screen and come back with my screen being locked but both my WiFi and VPN still connected.

You must log in to answer this question.

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