My specific case is that I am installing something from MacPorts and it's taking a very long time. I just want to close the lid of my laptop.
Will the compilation still continue?
I do not want to install the NoSleep app.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
As mentioned before, closing the lid of a portable Mac causes it to sleep, and not to dream of compilations as-yet unfinished.
If (and only if, apparently) your Mac is connected to:
your laptop will operate in "clamshell mode", as outlined here:
and your compilation will continue.
Generally, closing the lid will put your computer completely to sleep. Meaning any running processes will only continue once you wake the computer back up. There are very rare cases where this does not apply.
However, why must you close the lid? The way that MacBooks are designed, they're the best ventilated when the lid is open. If you close it, you can block the air outputs. You can operate your computer, or allow it to continue operating to finish a task, with the lid closed. But it isn't a good idea to do so if the task will be intensive in any way. And compiling is certainly intensive. Meaning you shouldn't close the lid when anything's compiling or installing from MacPorts.
So in short, no, software compiling will most likely not continue if you close the lid. And in addition, why would you need to? It's better not to as your computer will run cooler and last longer.
This may sound a little over-the top, but I found an ad-hoc way when I wanted to start a compile, walk to work from a coffee shop and have it proceed while on my way. There are several ssh apps for the iPhone. On your Mac, go to the "sharing" control panel and turn on "Remote Login" and "Internet Sharing". For "Internet Sharing", turn on iPhone USB. Now an iPhone that is tethered by USB to your Mac is on a LAN with your Mac. If the Mac is hosting an ssh login, it will not do "clamshell" behavior. The sharing control will tell you how to refer to you Mac when doing an ssh login. So on your iPhone, follow your App's instruction to connect to
So typically, it will look something like myaccount@ip-address, and you will have to give your account password. This will bring up a console and in my case, it was trivial to start a big make session in the background. I close the shell. Things keep moving. This is no walk in the park, if you forgive the pun. You have to make sure your iPhone doesn't sleep or it will close the ssh shell on its end. You also have to keep it tethered by USB (so in my case I had to throw it my backpack with the Mac.) There are ways to tether it via bluetooth or wifi, but my spirit of adventure ended with the one success. This may not solve your problem, but it did mine.