How to Prevent Mac from Sleeping When You Close the Lid

Keep Macbook Awake Lid Closed

When you close your Mac’s lid, it will quickly drift off to sleep. This is macOS’ default behavior, but there are times when this is the last thing you want. Here we show you how to prevent your Mac from sleeping, even when the lid is firmly closed.

Amphetamine: a free keep-awake utility for Mac

To conserve the battery, macOS gradually drifts off to sleep when you close the lid. However, there are multiple “keep-awake” utilities that can change this default behavior. One of the most popular keep-awake utilities is the free Amphetamine app.

When you launch this application, it’ll add an Amphetamine icon to your Mac’s menu bar.

Mac Lid Closed Amphetamine Macos App

When the Amphetamine icon displays a horizontal line, it means that Amphetamine mode is inactive, and your Mac will drift off to sleep when you close the lid. However, if you right-click or Control – click the Amphetamine icon, it’ll display a vertical line. This vertical line means that Amphetamine mode is active and your Mac won’t drift off to sleep, even with the lid closed.

You can toggle Amphetamine mode on and off.

The first time you activate Amphetamine mode, you’ll need to click the Amphetamine icon and specify the mode behavior:

  • Allow display sleep
  • Allow system sleep when display is closed. You’ll need to activate this setting in order to keep macOS awake with the lid closed.
  • Allow screensaver after 45 minutes of inactivity
You can configure Amphetamine's "stay awake" behavior, in the dropdown menu.

You can also start Amphetamine mode in this drop-down menu, either by specifying the amount of time Amphetamine mode should run (Minutes, Hours, Other Time/Until) or setting it to run indefinitely.

If you’re ever unsure whether Amphetamine is active or inactive, give the Amphetamine icon a click. If Amphetamine mode is inactive, you’ll see a “Start New Session” message.

If Amphetamine mode is active, then the drop-down will display the amount of time remaining until Amphetamine mode is automatically deactivated.

Don’t burn through your battery

The downside to preventing your Mac from sleeping is that it’ll use more battery.

There are some additional settings you can use to help prevent your Mac from running out of juice. To access these settings, click the Amphetamine icon in your Mac’s menu bar, then select “Preferences … ” You can then select the “Sessions” tab.

You can use Amphetamine and conserve battery power, using the "Preferences" window.

In this tab, you can allow macOS to sleep when the battery drops below a certain percentage. This can help prevent your Mac from hitting zero percent battery.

If you enable this setting, you can also use “Power Adapter” to override all battery-related settings when your Mac is connected to a power outlet. For example, you can configure Amphetamine to suspend the session if the battery drops below 10 percent, then start a new session as soon as your Mac is connected to a power outlet.

Start Amphetamine automatically

There may be certain scenarios where you’ll always want to keep your Mac awake. For example, when macOS is connected to a power outlet, external display, or drive. You may also want to keep your Mac awake when it’s connected to a particular network, such as your office Wi-Fi or a specific DNS server.

You can turn these scenarios into triggers that’ll launch Amphetamine mode automatically. To create a trigger:

1. Select the Amphetamine logo in your Mac’s menu bar, then choose “Preferences … ”

2. Select the “Triggers” tab.

You can start Amphetamine mode automatically, by creating a trigger.

3. Give your trigger a descriptive name.

You can select various criterion for your Amphetamine automated triggers.

4. Under “Criterion,” click the “+” symbol.

5. You can now choose the various types of trigger that you want to create. For example, to start Amphetamine mode when you launch a particular app, select “Application,” then choose an application from the list. To activate this mode when connected to your home Wi-Fi, select “Wi-Fi Network,” then type the name of your home network. You can chain multiple criteria together, although do note that all criteria must equate to “true” in order to activate your trigger.

6. Next, select the Amphetamine behavior this criterion should trigger. To prevent your Mac from falling asleep, make sure you select “Allow system to sleep when display is closed.”

7. When you’re happy with the information you’ve entered, click “Save.”

Now, your Mac will activate Amphetamine mode as soon as these conditions are met. New triggers are enabled by default, but you can disable a trigger at any point by navigating to “Preferences … -> Triggers.” In this menu, find the trigger you want to disable, then deselect its accompanying checkbox.

As you can see, it is easy to prevent your Mac from sleeping when you close the lid. Similarly, you can automate a lot of stuff on your Mac with the help of automator or easily fix a frozen screen in Mac.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Jessica Thornsby

Jessica Thornsby is a technical writer based in Derbyshire, UK. When she isn’t obsessing over all things tech, she enjoys researching her family tree, and spending far too much time with her house rabbits.