Closing your MacBook will put it to sleep. All foreground and background apps and services will be temporarily paused until you reopen the lid. If you’re playing music, for example, closing your Mac stops the song. Downloading a file or installing an app on your MacBook? macOS will pause (or terminate) the activities when you close the lid.

In this guide, we’ll walk you through two methods to keep your Mac awake when the lid is shut.

Table of Contents
    A Mac with its lid closed

    There are several reasons why you may need to do this. Say you want to use your Mac as a network server with the lid closed. Or perhaps, you’re downloading some files at a coffee shop but don’t want to leave your MacBook open on the table. 

    You can start the download, tuck the Mac in your bag, and enjoy your coffee while the download continues in the background. There are other use cases, but let’s jump to the techniques to prevent your Mac from sleeping when the lid is closed.

    The Native Method: Connect Your Mac to an External Display

    macOS is an intelligent operating system with obvious and little-known features. For example, the OS will keep your Mac up and running when it detects an external monitor or projector. This is called the Closed-Display Mode or Close-Clamshell Mode.

    In this mode, your Mac will stay on, even when the lid is closed. All you need to do is connect the following devices or peripherals and shut your Mac’s lid:

    1. An external display (monitor or projector)
    2. An external keyboard (wired or wireless)
    3. An external mouse or trackpad (wired or wireless)

    You most likely would need a USB hub with compatible ports to get this done, particularly if your Mac has limited ports.

    One more thing: You need to plug your Mac into a power source for this arrangement to work. So, in addition to connecting the above-mentioned peripherals, plug in your Mac’s power adapter and you’re all set.

    Mac plugged into a power source

    When these are in place, you can access your Mac on the external display with the lid closed.

    Note that some 4K and 5K monitors can power your Mac while acting as an external display. If you have this type of monitor (check the instruction manual or visit the manufacturer’s website to confirm), you don’t need to connect your Mac to the AC power adapter.

    Apple recommends putting your Mac to sleep before disconnecting the external display. So, open your Mac’s lid, click the Apple logo on the menu bar, and select Sleep. You could also select Shut Down to turn it off completely; your choice. Just don’t unplug the external display while your Mac is in Closed-Display mode.

    Method 2: Use a Third-Party App

    A Mac with its lid closed

    The native method of keeping your Mac turned on with the lid closed requires an external display, a mouse, and a keyboard. But what if you don’t have any of these peripherals? That’s where third-party applications like Amphetamine come in.

    It’s a reliable “keep-awake” utility with several functionalities that help manage your Mac’s display. You can use Amphetamine to prevent your Mac from sleeping with the lid opened or closed. It is totally free and available in the macOS App Store.

    From our experience, the app is lightweight (doesn’t use excessive system resources), has no in-app purchases or ads, and works perfectly. Open the App Store and search for Amphetamine. If you’re reading this article on a Mac, visit the Amphetamine details page on the App Store.

    Amphetamine in the app store

    Install the app and follow the steps below to learn how to use it to prevent your Mac from sleeping when the lid is closed.

    1. Launch Amphetamine from the Launchpad or Applications folder. You should see a pill-shaped icon on your Mac’s Status Menu—the right-side of your Mac’s menu bar. Select this icon to access Amphetamine’s menu options.

    Amphetamine icon

    Amphetamine doesn’t have a front-facing interface, so the menu bar is where you set up everything.

    2. On the Amphetamine menu, go to Quick Preferences and uncheck Allow system sleep when the display is closed.

    Quick Preferences and uncheck Allow system sleep when the display is closed

    3. A window displaying the features and effects of Amphetamine’s Closed-Display mode will pop up on the screen. Read through to understand how to use the app. Click OK to proceed.

    Features and effects of Amphetamine's Closed-Display mode and OK button

    4. Return to the app’s menu and choose how long you want to keep your Mac turned on with the lid closed.

    • Indefinitely: It will keep your Mac on until you manually end the Closed-Lid session.
    • Minutes: You can choose a preset period (between 5 to 55 minutes) within which the app will prevent your Mac from sleeping.
    • Hours: Amphetamine comes with preset hours: 1-10 hours, 12 hours, or 24 hours. Choose your preferred duration and your Mac will go to sleep when the set time frame ends.
    • Other Time/Until: Click this option if you want to set your preferred duration (in minutes or hours).
    Menu where you choose length of time to keep your Mac turned on
    • While App is Running: This allows you to keep your Mac turned on while a specific app is running in the foreground. When you click this option, Amphetamine will display all apps. Choose an app and click the Select button. Your Mac will stay awake while the selected app is running, even when you close the lid. If you want your Mac to play songs when you shut the lid, simply add Apple Music to this session configuration.
    • While File is Downloading: macOS interrupts ongoing downloads if your device goes to sleep. It’s annoying when this happens, especially if you have to restart the download from scratch. You can use the “While File is Downloading” option to prevent this from happening; Amphetamine will keep your Mac on until the download is complete.

    You can use Amphetamine without having to connect to a power source. Although your Mac’s battery might drain faster in this mode, you can configure the app to end a session when your battery drops to a certain percentage. Open the app’s menu and select Preferences.

    Amphetamine > Preferences

    In the System Defaults tab, select the option that reads: End session if charge (%) is below. Afterward, use the slider to select the battery level below which Amphetamine would end the Closed-Display session.

    End session if charge (%) is below

    To stop a Closed-Display session, open your Mac’s lid, select the pill-shaped icon on the menu bar and select the End Current Session button.

    End Current Session button

    To remove Amphetamine from the menu bar, open the Activity Monitor and force quit the app.

    There are other great apps that can help prevent your Mac from sleeping with the lid closed, but Amphetamine does a really great job. Plus, it sports interesting automation and customization options.

    Important Things to Note

    Keeping your Mac awake when the lid is closed comes with some downsides, too. For one, your device may get abnormally hot. This mostly happens when you’re running too many apps or when your Mac is left in Closed-Display mode for too long. To mitigate this, keep the closed Mac in a cool, well-ventilated room.

    Place the Mac in a vertical position when you shut the lid (use a vertical laptop stand, if you have one) so that heat dissipates from the device more evenly, particularly from the bottom case. Finally, avoid keeping your Mac in a backpack or other enclosed spaces for too long when it’s in Closed-Display mode. Drop a comment if you have any questions.