Production Expert

View Original

macOS Terminal Tricks For Audio Professionals - Grab Power For Your DAW

Hey, this is Steve DeMott with Production Expert, and I’m going to go over a couple of macOS terminal commands that I use all the time when I’m working, and I really need to make sure the OS doesn’t get in my way.

Pro Tools, as we know, is pretty CPU intensive. And I want my system to recognise Pro Tools as the most important thing running on my system. And when applications launch in macOS, they’re all given what’s called a “nice” score. That’s n-i-c-e, nice, as in “plays nice with others”. Every app launches with the same “nice” setting, which is zero. So they are all on equal footing in the eyes of my Mac.

Now, “nice” settings can be anywhere from 20, which is extremely willing to give up resources to other applications, to -20, the equivalent of the kid who takes everything on the playground and doesn’t share with anybody. And, when we’re dealing with Pro Tools, I like Pro Tools to be that kid on the playground that takes everything and won’t share. I like it to be -20.

So the way we do that is we want to change the “nice” rating on Pro Tools with a terminal command known as “re-nice.” But before we do that you need to know the process ID of Pro Tools, and it’s really easy to find.

With Pro Tools running, you bring up your search bar, and type in “activity monitor”, and launch that. This shows you everything that’s running on your Mac. And you go up to the search bar, and type in Pro Tools. And here it is. Here’s Pro Tools, and right now my process ID is 5832. That changes every time it launches, but for right now, and that’s how the macOS keeps track of what’s running. It gives everything an ID. So this, that’s the process ID, 5832.

So now what we want to do is launch terminal through the search. And we’re going to tell it to “renice” Pro Tools. But we have to do it in a specific way. We have to use the sudo command or “super user do,” which is basically a way of running a terminal command as the root user, which is a step above an admin user in macOS.

So we’re going to type: sudo, which is super user do. Then renice, which tells it to reset the nice setting of a specific application. We then tell it the new nice setting, which is -20 in our case, and then which ProcessID is getting reniced, which is 5832 in my case. Remember, -20 is basically saying, “Make Pro Tools as greedy as possible. Give it as much CPU power as it asks for, and if something else needs to get interrupted, that’s fine.”

Now, when we hit return it’s going to ask for your password. This is your Mac login password. If you are not an admin on your Mac, this won’t work. So I’m just going to put my password in. Unless it gives you an error, it has done it. Now we have ProTools running with priority.

I don’t know about you, but no matter how I set my energy saver power settings to never sleep, never lock the screen, and all that, it still does. And the worst thing for me is when I’m on location doing a location recording, you have your system up and running, you run over to go take care of something, it takes just long enough that you come back, and the screen has locked, and now you can’t get in without having to type your password, then you can make that adjustment that you were trying to make, and it goes on and on and on like that all day long. This next trick takes care of that.

I discovered this great little built-in utility called Caffeinate. And, if you Caffeinate your machine, it keeps it awake, but you have to tell it to do specific things to suit our purposes using hooks or modifiers for this. You precede each hook one with a hyphen, hyphen-D says caffeinate, don’t let the display go to sleep, don’t let it lock, no matter how long I’m away.

And hyphen-I, do not let the system idle sleep, no matter how long it is before I come back, and wiggle the mouse or, or touch a key. You hit return, and it looks like it locked up, but what’s happened is Caffeinate is now running. And it will keep your Mac awake, and you can just go ahead and minimize the terminal window, and then just continue working.

There are a couple other hooks for Caffeinate that you might want to know about, but they’re not extremely useful, in my opinion.

You can use hyphen-M just to keep the disk from sleeping, but with Pro-Tools running it’s constantly accessing the disk. That’s really unnecessary, in my opinion. The disk isn’t going to sleep.

Hyphen-S will keep it awake, as long as you’re on a/c power, as long as you’re plugged into the mains. Only applicable to laptops, but, again, I just want it to stay awake, I don’t want to condition. If somebody accidentally kicks my power adapter, I want it to stay awake. I’ll notice & plug it back in.

Hyphen-U will set a user timeout of 5 seconds before caffeinate will release. You can set it to any amount you want, in seconds. I can’t really see a good reason for limiting the caffeinate command to a specific time period. It’s easier to quit caffeinate when I’m done than trying to figure out how long I’ll be working.

And then Hyphen-W, might be the only option that could be useful. Hyphen-W allows you to keep caffeniate active while a specific application is running. You would use -w with the app’s ProcessID, like we did with renice.

I think it’s just as easy, when I’m done, to pull this up, if you hit control-C, it stops Caffeinate. Caffeinate is no longer running. My renice still holds until I quit Pro Tools. Once Pro Tools is quit it won’t launch reniced.

So there you have 2 simple terminal tricks, that you will, hopefully, find, useful.

One More Terminal Trick

When you launch terminal, you can hit the up & down arrows to cycle through previously entered commands. This is helpful to quickly invoke these commands over and over (just remember to get the current ProcessID for renice, since it changes with every launch).

GUI Options

For those who would prefer to avoid Terminal, there are GUIs to these same commands.

An alternate/GUI interface for renice is to download CPUSetter & use it to renice Pro Tools. An alternate/GUI interface for caffeinate is the Amphetamine app.

WARNING: This article is for information only. Always back up your drive before making any changes to a hard drive using either Time Machine or a third-party application like Carbon Copy Cloner.

See this content in the original post