How to prevent your Mac to sleep when closing lid

Updated : Nov 23, 2021

The MacBook series automatically goes to sleep when you close the screen, but you may not want to put it to sleep.

Here, I will explain in detail the two steps, one using the standard Mac functions and the other using the app, with illustrations.



Introducing “Clamshell Mode (Lid Close Mode)” for Mac

Notebook Macs have traditionally been called “Clamshell Mode (Lid Close Mode)”.

This is a way to use your Mac without going to sleep with the screen closed if the following conditions are met:

  • Connect AC power supply
  • Connect an external display
  • Connect an external keyboard (USB or Bluetooth connection)
  • Connect a trackpad or mouse (USB or Bluetooth connection)

In other words, if the above conditions are not met, it will go to sleep when the screen is closed.

Then, for example, if you want to download a file for a long time, encode a video, or use a Mac as a server without connecting an external display, you want to close the screen but put the power to sleep. There are times when there is no such thing.

Hereafter, I will show you how to do it.



① How to use the terminal command line

You can set it by executing the command line from “Terminal” which is a standard tool of Mac without installing some application.

①-1 Steps to disable / enable sleep when the screen is closed

▶ Start “Terminal” from the Finder folder “Applications” – “Utilities”.

Mac Finder

Mac Finder "Terminal"


▶ When “Terminal” starts, copy one of the following commands and paste it in the location of the command prompt.

Command to disable sleep

sudo pmset -a disablesleep 1

Command to enable sleep

sudo pmset -a disablesleep 0


In the following screens, it is the case of “Command to disable sleep” as a sample.


▶ To paste, select “Paste” from the right-click menu or select the keyboard shortcut command ⌘ + V.

Mac Finder "Terminal"

Mac Finder "Terminal"


▶ After pasting the command, press return on your keyboard to execute it.

Mac Finder "Terminal"


▶ You’ll be prompted for a password, enter the password you used to install the app or log in to your Mac, then press return.

Mac Finder "Terminal"


▶ After executing the command, check the following “①-2 Steps to check the current settings” to make sure that the settings are correct.


①-2 Steps to check the current settings

▶ Start “Terminal”, copy the following command, and paste it at the command prompt.

pmset -g


▶ After pasting the command, press return on your keyboard to execute it.

Mac Finder "Terminal"


▶ Check the “SleepDisabled” line in the command execution result.

  • If 1, sleep is disabled
  • If 0, sleep is enabled

Mac Finder "Terminal"


▶ After completing the settings, select “Terminal” – “Exit Terminal” from the “Terminal” menu bar to exit the terminal.

Mac Finder "Terminal"



② How to use the app “Amphetamine”

It’s unlikely that you’ll find an app that doesn’t put you to sleep with the screen closed.

In the past, the app “Insomnia X” was a standard, but its update has stopped since 2016, and it is difficult to install or install it after macOS 10.12 Sierra.

GitHub - semaja2/InsomniaX: InsomniaX - Keep your Mac awake the easy way
InsomniaX - Keep your Mac awake the easy way. Contribute to semaja2/InsomniaX development by creatin...

At the moment in 2021, an app called “Amphetamine” has become a staple.

This app is free and distributed from Apple’s official Mac App Store, so it is highly reliable in terms of security.

It is compatible with macOS 10.11 El Capitan and later, and is also compatible with M1 Mac and macOS 11.0 Big Sur.

Also, since it is a very versatile app, if you haven’t used it yet, we recommend that you first read the article linked below to see how to use it roughly.

How to use the Mac sleep control app "Amphetamine"
I will explain how to use the Mac sleep control application "Amphetamine" in an easy-to-understand m...


From now on, we will introduce the procedure to prevent sleep even if the screen is closed, assuming that “Amphetamine” is already installed.

▶ With Amphetamine running, click the icon on the menu bar to display the menu.

"Amphetamine" menu bar


▶ When the menu is displayed, select “Preferences …”.

"Amphetamine" menu bar


▶ When “Preferences” opens, click the tab “Session Defaults” at the top of the screen.

"Amphetamine" Preferences


▶ After switching to “Session Deafaults”, uncheck “Closed-Display Mode: Allow system sleep when display is closed”.

"Amphetamine" Preferences


▶ When “About Closed-Display Mode Sessions” is displayed as shown in the figure below, click the button “Get Amphetamine Enhancer” at the bottom of the screen.

"Amphetamine" About Closed-Display Mode Sessions


You can use the wakeup function without installing this “Amphetamine Enhancer”, but install it safely as explained here.


▶ As shown in the figure, a web browser opens and the GitHub site opens.

Once open, click the “Right here” link below “Where Do I download Amphetamine Enhancer?” at the bottom of the screen.

Amphetamine Enhancer GitHub


Below is the screen near the bottom.

Amphetamine Enhancer GitHub


▶ When the application download screen is displayed, save (download) it in a suitable location.



▶ After downloading, open the file and drag and drop “Amphetamine Enhancer” into the folder “Applications” to install it.


Macアプリ「Amphetamine Enhancer」のインストール


▶ When you’re done dragging and dropping, double-click to launch it.

Macアプリ「Amphetamine Enhancer」のインストール起動


▶ There is a security check when you start it for the first time, so click the “Open” button when the screen shown in the figure opens.

Amphetamine Enhancer


▶ When the installation screen is displayed as shown, select “Closed-Display Mode Fail-Safe” from the list on the left and click the “Install” button.

Amphetamine Enhancer


▶ If “Install was successful” is displayed as shown in the figure, the installation is successful.

Macアプリ「Amphetamine Enhancer」のインストール起動


▶ To close “Amphetamine Enhancer”, select “Amphetamine Enhancer”-“Quit Amphetamine Enhancer” from the menu bar.

Macアプリ「Amphetamine Enhancer」のインストール起動


▶ Just in case, restart your Mac.


▶ After rebooting, uncheck “Closed-Display Mode: Allow system sleep when display is closed” from “Session Defaults” in Amphetamine’s “Preferences” again.

"Amphetamine" Preferences


▶ When “About Clamshell Mode Session” is displayed as shown in the figure below, click the “Confirm” button at the bottom of the screen.

"Amphetamine" About Closed-Display Mode Sessions


▶ When you return to the settings screen, make sure it is unchecked.

"Amphetamine" Preferences


▶ In addition, click the “General” tab and check “Launch Amphetamine at login”.

Please note that if this is not checked, that is, if Amphetamine is not running, it will go to sleep when the screen is closed.

"Amphetamine" Preferences


▶ After completing all the settings, click the red button at the top left of the screen to close the screen.

"Amphetamine" Preferences




On this page, I’ve introduced two ways to keep your Mac from sleeping when you close it.

There is no particular superiority or inferiority, so I think that you should choose according to the circumstances and tastes of each individual.

Recommended for these people
① How to use
the terminal command line
  • People who are accustomed
    to terminal commands
  • People who want to use
    standard Mac features
    as much as possible
  • People who are banned
    from installing apps
    on their company or school
② How to use
the app “Amphetamine”
  • People who want to
    easily set up with the app
  • People who are not accustomed
    to using terminal commands
  • People who are prohibited
    from using terminal commands
    on their company or school

If you close the screen and continue high-load processing for a long time, there is a high possibility that the built-in battery and logic board will deteriorate or malfunction, so be careful of heat dissipation by hitting it against metal.

In my personal experience, when I was developing with Xcode or Android Studio using clamshell mode (lid close mode) on a MacBook Pro 15 inch, the battery swelled due to heat.



Reference Information


This is the end of the article on this page.


PHP Code Snippets Powered By :
Copied title and URL