5

When your Mac sleeps, it puts all apps into sleep mode. This disconnects them from the internet and halts processing in order to preserve power when power isn’t needed.

I would like to be able to do the same for my open apps while I’m actively using my Mac, (specifically the heavy ones that take a very long time to boot up, which are incidentally the ones sucking up resources while in the background).

If there’s a set of terminal commands or a 3rd party application that can achieve this, I’d find it incredibly useful for conserving my battery life and CPU load during the day.

4
  • 1
    If an app is doing nothing then it should not be using CPU - if it is using CPU then it is doing something and stopping it could cause issue later. Which apps are using resources that you say are sucking up resources?
    – mmmmmm
    Jul 9 '21 at 9:12
  • 2
    Putting my Mac to sleep doesn’t cause any issues for the apps upon re-awakening. I don’t see why doing the same thing on a more focused level should cause issues. A good example of an app I’d use this for would be a modded Minecraft launcher. Depending on the number mods and their sizses, it can take over half an hour in order to launch. After which point, you’d want to keep it in the background so you don’t have re-launch it, but it can be incredibly CPU intensive even in the main menu.
    – justis
    Jul 9 '21 at 9:37
  • The apps should be sleeping anyway if you have not told them to do anything. They should not be using CPU unless youi have instructed them or they have a reason to do something. The only resource they should be using is memory and that can be swapped out
    – mmmmmm
    Jul 9 '21 at 9:51
  • You could look into using containers or other forms of virtualization, they're perfect for these kinds of usecases. Jul 9 '21 at 19:23
8

You shouldn't need to do this on a well-behaved system. If you have specific issues with certain apps, please post separate questions for each of them so that we can find targeted ways of getting them to behave better.

Nevertheless, it is easy to suspend and resume any process:

  1. Determine the PID (process ID) of the app you want to suspend. You can do this via Activity Monitor, ps, top, or whatever method you want.

  2. Send a SIGSTOP to that process. This will suspend the process so that it will get no CPU time. E.g., if the PID is 12345,

    kill -STOP 12345

  3. When you want to resume using the app, send it a SIGCONT:

    kill -CONT 12345

You can also use killall to specify a process by name rather than PID. Note that, by default, this will send that signal to any process you own matching the process name. See man killall for more details.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .