Note: This is only relevant if you are using a MacBook with a discrete graphics card. This includes modern 15” and 16” MacBook Pros. This will not work on any MacBook Air.

Now that I’m used to the consistently excellent performance of my iMac Pro, using my MacBook Pro is an exercise in frustration. It’s not just the terrible keyboard (although that’s a big part of it), it’s also the consistent feeling of lag I experience whenever I’m using the device.

Many people who read this will likely already know, but 15” and 16” MacBook Pros have two graphics cards. One is the integrated card, which is part of your machine’s regular CPU. The other is the discrete graphics card. The discrete graphics card is the machine’s isolated GPU; it runs separately from the onboard CPU. It’s much faster, runs hotter, and uses way more power.

After some googling, I figured out that my lag problem is related to the laptop’s integrated graphics card. You may experience similar issues with your machine; it’s not uncommon. The solution is to use the machine’s discrete graphics card instead.

Because the discrete GPU uses more energy, I don’t want to use it when I’m on battery power. It would quickly drain the battery. When I’m on the go, I want to optimize for long-lasting battery above almost all else.

But when I’m plugged in and charging the laptop, I always want to use the discrete graphics card. It makes the machine run much more smoothly, and removes any scrolling or keyboard or lag I experience in regular use.

That being said, there is no setting to change this in System Preferences. If you want better laptop performance while plugged in, and your laptop has a discrete GPU (i.e. a 15” or 16” MacBook Pro), then you need to use the command line.

Here’s what you want to type in the command line (in the Terminal app):

sudo pmset -c gpuswitch 1

You’ll be asked for your password (sudo tells the machine you’re the administrator), and then you’re done.

For people who are new to the command line, here’s an explainer of how this works.

This command adjusts the power management settings for the laptop’s chipset using something called pmset. You can adjust the power management settings while you’re on battery (pmset b), while you’re charging (pmset c), and all at once (pmset a).

The above command began with pmset c, which tells the machine you want to adjust power management settings for situations when you’re charging. Then, it tells the computer to always use the discrete GPU while charging (that’s what gpuswitch 1 does).

To reset this, you just need to type the following:

sudo pmset -c gpuswitch 2

gpuswitch 2 tells the machine to automatically switch between discrete and integrated graphics.

You can also run sudo pmset -c gpuswitch 0 if you want to always use the integrated graphics card while you’re plugged in.

You can modify any of these settings for different battery status situations. If you want to make these changes for situations when you’re running on battery power, any of the following will work (note we’ve just swapped pmset -c with pmset -b):

# Always use the integrated graphics card while running on battery power
sudo pmset -b gpuswitch 0

# Always use the discrete graphics card while running on battery power
sudo pmset -b gpuswitch 1

# Switch between discrete and integrated graphics cards automatically while running on battery power
sudo pmset -b gpuswitch 2

And if you want to control this setting globally, whether your laptop is plugged in or not, you just need to change pmset -b to pmset -c.

# Always use the integrated graphics card
sudo pmset -a gpuswitch 0

# Always use the discrete graphics card
sudo pmset -a gpuswitch 1

# Automatically switch between discrete and integrated graphics card (this is your laptop's default setting)
sudo pmset -a gpuswitch 2

And now you have finer control over your laptop’s power settings! If you want to make sure this is working, you can open Activity Monitor and view the Energy pane. The Graphics Card setting near the bottom of the window will tell you which card is operating.

(And thanks to Reddit user Freneboom, who gave me just enough information in this Reddit thread to figure all this out.)