Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jsboos

macrumors newbie
Original poster
May 10, 2019
1
0
Hi,

is there any possibility, to have wifi (mac) still ON, when I am on battery and have closed lid?

For example: I have disconnected from AC, closed lid, move to meeting... in next few minutes I open macbook and I can see, that wifi is on, but all my work staff (VPN, company chat,...) are reconnecting. So it means, from my POV, that WiFi was off....

Any advise, how to prevent wifi disconnection?

Thank you in advance
 
I think what you are looking to do is temporarily prevent your macbook from sleeping. In mojave, you can only disable sleep with the lid closed with a third party app or a terminal command. Amphetamine is one such app. In order to disable sleep via terminal, type this command:

sudo pmset -b disablesleep 1

Then, press enter and you will be asked for your login password. Sleep is now disabled. To enable sleep, type this command:

sudo pmset -b disablesleep 0

Then, press enter and you might be asked for your password again if a lot of time passes. Sudo stands for super user do, pmset refers to power management settings, and -b refers to while on battery power(you can replace this with -aif you want it to apply when you are plugged in). If you plan to do this all the time, you might want to make an applescript program. To do so, launch Script Editor, create a new document, and paste this into it:

tell application "Terminal" to activate
tell application "System Events"
delay 0.5
keystroke "sudo pmset -b disablesleep 1"
keystroke return
delay 0.5
keystroke "your password"
keystroke return
keystroke "h" using {command down}
end tell

If you prefer to type your password yourself (more secure) then try this:

tell application "Terminal" to activate
tell application "System Events"
delay 0.5
keystroke "sudo pmset -b disablesleep 1"
keystroke return
delay 5
keystroke return
keystroke "h" using {command down}
end tell

Terminal will be hidden in your dock when the script has finished running. Save the script as a program.
To enable sleep, create a second document and paste this into it:

tell application "Terminal" to activate
tell application "System Events"
delay 0.5
keystroke "sudo pmset -b disablesleep 0"
keystroke return
delay 0.5
keystroke "your password"
keystroke return
tell application "Terminal" to quit
end tell

I chose to name my two programs Caffeinate and Decaffeinate.

Hope this helps!
 
when you close the lid, your mac sleeps; that's the point. but there are apps (look for 'insomniac mac') that should do what you want.

EDIT: post above mine! (we posted same time), good info...
 
  • Like
Reactions: jsboos
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.