Set GPU behaviour base on power source

airlied

macrumors 6502
Original poster
Jul 8, 2011
381
56
I don't know how many people already know this. If this already is a common knowledge please let me know.

You know, many people want their 15' Macbook Pro to use integrated intel GPU only when on battery for obvious reason (mainly because there are so many poorly-coded apps unnecessarily switch to discrete GPU), but automatic graphic switch when on AC power.

Years ago there been a solution called gfxcardstatus which allowed you to do exactly that. But not anymore since the developer removed the very function.

But I still wanted to achieve this.

So I tried this:

type

sudo pmset -b gpuswitch 0

and

sudo pmset -c gpuswitch 2

(source: https://discussions.apple.com/thread/2777617)

in Terminal.

And it works.

I tried these two commands, then restart the mac, pull of AC cord, open Photoshop, iMovie, Final cut pro (those who definitely suck gpu power). The gpu stays at Intel UHD Graphics 630 1536 MB (you can tell it from system report or About this Mac).

Then type pmset -g, the gpuswitch status is 0.

Then connect AC power, the gpu immediately switched to radeon pro 560X (gpuswitch turned to 2).
Close all those apps, the gpu automatically turned back to Intel UHD.


--------------------------------------------------------------------
For those who don't know, pmset refers to power management settings. Typing [pmset -g] could get you all the information related to power settings.

Usually 1 refers ON and 0 is OFF. But for some settings with multiple status other numbers could be seen.

Typing pmset -b, followed by settings name, means making whatever you want it to be takes effect only when on battery.

Typing pmset -c, followed by settings name, means making whatever you want it to be only take effect only when charging (AC is on).

Typing pmset -a followed by settings name, means making whatever you want it to be always work no matter what power status it is.

Apple didn't say what number stands for, but now I'm pretty sure
gpuswitch 0 = integrated GPU;
gpuswitch 1 = discrete GPU;
gpuswitch 2 = auto switch.
--------------------------------------------------------------------


So it works as should be. This shouldn't be a surprise. What surprises me is there are still so many people asking for this specific question and no one even mentioned this simple solution.

BTW if you want automatic graphic switch when on battery, and always discrete on AC power, try
sudo pmset -b gpuswitch 2
and
sudo pmset -c gpuswitch 1
 
Last edited:

iMacDragon

macrumors 68000
Oct 18, 2008
1,861
350
UK
I don't think even need to restart.. good spot, I've been wanting to completely disable dgpu when on battery..

Though one downside seems to be that it won't even switch to dgpu is plug external display in! So have to remember that if do this.
 

airlied

macrumors 6502
Original poster
Jul 8, 2011
381
56
Though one downside seems to be that it won't even switch to dgpu is plug external display in! So have to remember that if do this.
I think It will switch to dGPU when external monitor in. Read an article before saying that with external display dGPU is gonna on no matter what settings. But I might be wrong, let me run a test.
 

iMacDragon

macrumors 68000
Oct 18, 2008
1,861
350
UK
I think It will switch to dGPU when external monitor in. Read an article before saying that with external display dGPU is gonna on no matter what settings. But I might be wrong, let me run a test.
It won't, I tested it. Which surprised me, for being an inbuilt function, even if one not exposed directly to user.
[doublepost=1536721253][/doublepost]
The continued development of gfxCardStatus was picked up by another developer.

Please see here:

https://github.com/steveschow/gfxCardStatus

Binary Installs, here:

https://github.com/steveschow/gfxCardStatus/releases
I found this to to not work reliably, it infact ended up forcing dgpu after quitting normally dgpu using apps often. ( the app ran on igpu, but after quitting it, the status ended up flipping to dgpu! )
 

airlied

macrumors 6502
Original poster
Jul 8, 2011
381
56
The continued development of gfxCardStatus was picked up by another developer.

Please see here:

https://github.com/steveschow/gfxCardStatus

Binary Installs, here:

https://github.com/steveschow/gfxCardStatus/releases
Thanks for letting me know. But since a command could solve this I think I'll pass. Perhaps other people are
I have not had any issues with it at all.

I would suggest @airlied that you install it and try it for yourself. No harm in trying.......right ?!
Yup thanks! So far the commands work fine for me so I'm gonna use gfxCardStatus for notification purpose only.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.