Keep a MacBook Running While Closed Without Going to Sleep with NoSleep

Feb 10, 2012 - 34 Comments

Closed MacBook Air

With traditional clamshell mode for a MacBook Air, MacBook Pro, or Macbook, an external display, mouse, and keyboard must be attached in order to maintain the running closed-lid clamshell state. Thanks to a third party kernel extension called NoSleep we can now remove those hardware limitations and run a Mac laptop with the lid closed and no hardware attached.

Installing NoSleep is easy and places a System Preference panel for configuration, along with a menu bar item that lets you toggle the NoSleep function similar to the Caffeine app, but only impacting lid sleep behavior.

Closed MacBook No Sleep

Check “Do not fall asleep when lid is closed” and you can freely shut a portable Mac without the machine sleeping, even without a keyboard or display attached. This is great if you have an old MacBook laying around you want to use as a file server or wireless media center, or you just want to close a Mac while it sits quietly on a desk downloading large files or anything else – just remember to keep the Mac well ventilated when running with the lid closed.

If you’re done with NoSleep or just don’t find it useful, uninstalling NoSleep is best achieved through the bundled uninstaller bash script.

This extension was found on Twitter, although I can’t recall who from or the origin tweet. Thanks to whoever it was!


Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks


» Comments RSS Feed

  1. James Cordell says:

    Does anybody know who the dev is? I am trying to contact them but I can’t find any way to contact them?

  2. westwoodking says:

    I’ve started using my old ’07-’08 Black MacBook 2.4 Ghz/2 Gb/250 Gb HD as a DVD player, external 2 Tb harddrive player, and video streamer attachment for my 42′ Samsung. It is great. I have it paired with a wireless keyboard and Magic Mouse. We use Apple TV for Netflix and the like. MacBook works great thoughx. With NoSleep, the MacBook just sits up there full-time like any other component. Thinner than most DVD players, too. It is connected with a mini-VGA to HDMI. Streamed HD video still looks great.

    For heat concerns, I’ve hidden/placed two 1×2 stained slats of wood underneath. Stays just as cool as during normal use. When we’re done using it, we just put it to sleep. Hit esc to wake it up!

  3. Adam says:

    Great! Thanks. Wondered how I might be able to use teamviewer while lid is closed and no ext keybd and mouse. This works! Thanks!

  4. adamlogan says:

    PS to the paranoid, don’t be ridiculous. Closing the lid is no big deal. I’ve been doing it forever with macbooks and macbook pros via insomniax, never had an issue. I’d say it’s even less of an issue for the newer machines such as the macbook pro I have now (bought this past month in Sept 2012). I don’t even have to turn down the brightness all the way, the backlight just turns off, I love it!

    Thank you so much for this, this is exactly what I wanted. I love the fact that there is the option for adding the bin for command line access. I’ll explore that later, but I have what I need for now. Listening to binaural music happily in bed thanks to this.

  5. Efjay says:

    Follow up to my last post, I have found further heat damage to my MacBook, the cracks I’ve mentioned have become severe and the plastic hinge is breaking off in small pieces. Also I’ve noticed severe damage to the LCD panel from heat and the machine runs hot constantly. If anyone is thinking they can get away with using a laptop as a server, please, please think again, it may work a while but you will almost certainly wreck the machine with prolonged use. It’s simply not designed to work that way, feel free to try it, but a MacBook is damn expensive machine just to try a server experiment on. Get a machine designed to run as a server. Bearing in mind this machine ran flawlessly before I tried using it as a fileserver, I really wish I’d never bothered, if this info helps to save someones MacBook from being toasted then I’ll be happy.

  6. Efjay says:

    It’s no fault of the NoSleep app at all, but my experience of using an old MacBook Pro as a file server hasn’t been great. First a power supply went bang after a month, then by the second to third month, the machine developed cracks around the hinge and began to run ever hotter even when idle. It may be better to use another solution, I’m replacing it with a NAS server.

    But the app itself does exactly what it’s supposed to great, I just wouldn’t run a laptop as a server again.

  7. Mark says:

    Nice info about pmset. The way I read the manpage, setting a hibernate mode doesn’t affect whether it sleeps or not, but whether it persists memory state to disk when it does so. I think the following should work :

    sudo pmset displaysleep 0 disksleep 0 sleep 0 womp 0

    pmset -g is also useful to see what your current settings are. Maybe a good way to verify what nosleep or insomniaX are doing.

    I installed nosleep last night and set the preferences to not sleep in battery or line power mode; but it still went to sleep after I left for work. Will look at it when I get home, but it doesn’t seem to be working for me.

  8. Rob says:

    Sorry, should have been:

    Ignore lid close:
    sudo pmset hibernatemode 0

    Reset to default:
    sudo pmset hibernatemode 1

  9. Rob says:

    Does this command line not do the same thing?

    Ignore lid close:
    sudo pmset -a hibernatemode 0

    Reset to default:
    sudo pmset -a hibernatemode 1

  10. Shawn says:

    So is InsomniaX or Nosleep the better choice. Any chance of a pros vs Cons

  11. Chris says:

    Is anyone else experiencing this?

    I’ve had this utility disabled since install as I don’t want it active all the time. To do this, under System Preferences, I’ve unchecked both options but every time I reboot, the option for “Do not fall asleep when lid is closed” is checked again and the unit is not going to sleep when I close the lid.

    So the app seems to be activating itself upon boot despite not being checked prior to do so and in this situation, the icon for the app is not showing in the upper bar to let me know this is happening.

  12. iGnome says:

    Ah now I see where I went wrong. I lost the icon because I used a right click on the menu bar icon to quit the app. However I did not have ‘start no sleep utility on system start up’ box checked from within system preferences menu. I suppose ideally there would be the option to launch the app rather than have to check this box and re boot. But I understand that it’s more of a utility than an app and that simplicity is important. So as long as I have no need to quit the utility then I can live with it! Thanks once again to the developer for sharing this and OSX Daily for bringing it to my attention

  13. […] you want to get around the physical hardware connectivity requirements, use the NoSleep tool we mentioned recently which lets you run the Mac closed with no hardware attached at […]

  14. iGnome says:

    I downloaded this and it was working fine but after a re boot I don’t have the no sleep icon in my menu bar and putting it there is not in the options that I can choose. Any idea how I can get the icon back? It’s really important for me to be able to switch this on and off easily.

  15. eldee says:

    Hi, any chance to get the wallpaper ?? ;)

  16. flat_line says:

    unfortunately, it doesn’t seem to work with screen sharing mode. or it is and Iv’e missed something here?

  17. ehutchins says:

    The bottom of the unibody and the rear slots along the hinge are used to cool the computer. Close the lid and look at the bottom of the hinge. There they are. ;)

    Here is the advice from the Apple site:

    “Using Your MacBook Pro

    When you’re using your MacBook Pro or charging the battery, it’s normal for the bottom of the case to get warm. For prolonged use, place your MacBook Pro on a flat, stable surface. Do not place your MacBook Pro on your lap or other body surface for extended periods of time. Prolonged body contact can cause discomfort and potentially a burn. The bottom of the MacBook Pro case functions as a cooling surface that transfers heat from inside the computer to the cooler air outside. The bottom of the case is raised slightly to allow airflow, which keeps the unit within normal operating temperatures. In addition, warm air is vented from the slots in the back of the case.”

  18. Ric says:

    Brilliant, and simple. No extra heat at all on Macbook Pro Unibody 2.8. Note, others are completely correct: the computer vents out the back and left side only, open or closed. After two hours of clamshell operation downloading large files, NO increase in either temperature or fan speed as measured by iStat.

    One caveat is that if you normally have your computer lock its screen when closing it, you will have to do this manually using NoSleep. No big deal, just a swipe across the TrackPad should do it. This might be a nice feature to add.

    Regards to all.

  19. don says:

    ok that is good news. How about this one. I scavenged the hard drive from my Mac Pro when I sold it as it is a 2T and want to use it as an external hard drive on my Mac Book Pro. What hurdles am I going to encounter?
    The Mac Pro had Snow and my Book has Lion.


  20. Chris says:

    In addition to keeping the MB elevated and clear of obstruction, would running a program like SMCFanControl help keep it cooler when closed?

  21. Jose says:

    I really like this Idea. I remote from work to my macbook pro and I would like for it to be with the lid closed so that dust does not accumulate.


  22. Don says:

    When InsomniaX wasn’t working for Lion I switched to SleepLess, which works nicely. I really only wanted it to work when AC power is attached and, as I recall, I needed to change a default setting to accomplish that.

    I haven’t seen an issue with overheating but I only use it when it’s sitting on a countertop. I wouldn’t want to leave it running when it’s closed up in my shoulder bag.

  23. Matt says:

    Clamshell is a lot easier in OS X Lion. Plug in a keyboard or mouse, or connect something to the Mini DisplayPort, then close the screen. That’s it, Mac still runs, lid is closed.

    • Mike says:

      I have Magic Track Pad and Keyboard connected via Bluetooth. then TV connected via Mini Display.

      Does that count? Or does the Keyboard and mouse need to be literally connected via USB?

  24. Darren says:

    InsomniaX is another and long standing alternative. Though the developer says this is his last version (v2 for Lion).

    Belgium Waffle makes a very valid point though. Personally, I use InsomniaX for when I’m at work and moving around in meetings – i.e. short term “clamshell”.

  25. Belgium Waffle says:

    Guys just a FYI, the reason Apple canceled the option for it’s new version of MacBooks to run in “clamshell mode” is due to the new unibody design. The new unibody design doesn’t allow any air (or little air) to flow through the cracks. Therefore by applying this “NoSleep” hack you might easily over heat your device without knowing it.

    Eat a Belgium waffle and increase your brain musscle.

    • American Burgers says:

      This is true you definitely need to keep a MacBook raised or put on a stand to be safe, the keyboard and right below the “MacBook” text is how they vent heat.

      I hear putting a unibody MacBook on a waffle iron increases it’s velocity, but the best thing to do is to place a good old american cheeseburger patty right between two waffles as buns. Delicious and improves your vision.

    • Dekard says:

      This is flat out false. The new version of Macbooks do run in clamshell mode and vent out the side. They also do not vent out the keyboard as there is a panel the width of the keyboard.

      • Dekard says:

        There is no ventilation through the speaker grille or keyboard on any Mac notebook, and there never was. All venting, both intake and exhaust, is at the rear, near the hinge.

        There is a solid sheet under the keyboard, preventing any meaningful airflow. Clamshell actually uses less power as well because your Mac’s display is turned off.

      • Eleven says:

        I have closed the lid on my 2010 MBP, shot air into the vents, opened the lid and saw dust on the screen in the shape of outlined chiclet keys, indicating that dust blew between the keys and stuck to the screen. There is some level of ventilation there, but I believe the vent does most of the work. I would imagine they designed the machine to cool itself when closed, since you can run it that way with keyboard and mouse. (I realize this is an old thread, but I feel this information is a good addition).

    • Joseph says:

      Actually air vents through the ports on the side. I leave mine on overnight every night and it’s never more than warm in the morning.

  26. Mike says:

    Words cannot express how happy this news makes me!

    I connect my 13″ MBP to my 46″ LCD HDTV for movies and TV shows.

    Even though I would turn the screen around so It was not facing my direction, I could still see the screen flashing off to the left (esp. with the lights off).
    It bothered my knowing I was putting unnecessary use on my MBP’s screen.
    This always bothered the crap out of me!

    I would think to myself, this computer does so many amazing things, how come I cannot use it while the screen is closed? haha

    I almost want to take a half day to go home and download this app!



Leave a Reply


Shop on and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site