How to check which video card is active in a MacBook Pro?

Assuming system_profiler will only report the active display (I'm not near a MBP to know) how about plugging this into GeekTool:

system_profiler | grep GeForce | sed -e 's/:/ /'

Edit:

If it lists the non active one on the same line as "display not connected" how about:

system_profiler | grep GeForce | grep - v "display not connected" | sed -e 's/:/ /'

If it lists the active one first how about:

system_profiler | grep GeForce | head -n 1 | sed -e 's/:/ /'

If active is second then replace head with tail.


http://codykrieger.com/gfxCardStatus

This is a small app that resides in the bar and gives you not only the card in use but also the control over how and when to switch the card. For example you can set only integrated graphics card to run when on battery power - etc...


Using the basic idea presented in the other two answers, I wrote the following scripts to determine if you are using the "correct" video card (Correct = "on battery and using the 9400" or "on ac adapter and using the 9600")

I have no idea how fragile these scripts are... they rely on specific data appearing in a particular order in the system_profile plist... but this order seems consistent on my machine. Placing it here for anyone who ever finds this via Google.

Ruby: (requires the "Plist" gem to be installed)

# video_profiler.rb
require 'rubygems'
require 'plist'

# calculate video data
data = `system_profiler SPDisplaysDataType -xml`
structured_video_data = Plist.parse_xml(data)
display_status = structured_video_data[0]["_items"][0]["spdisplays_ndrvs"][0]["spdisplays_status"]

if (display_status.eql?('spdisplays_not_connected')) then 
    card = '9400'
else
    card = '9600'
end

# calculate power source data
data = `system_profiler SPPowerDataType -xml`
structured_power_data = Plist.parse_xml(data)
on_ac_power = (structured_power_data[0]["_items"][3]["sppower_battery_charger_connected"] == 'TRUE')

# output results
if (on_ac_power and card.eql?'9400') or (not on_ac_power and card.eql?'9600'):
    result = 'You\'re on the wrong video card.'
else
    result = "You\'re on the correct video card."
end

puts(result)

Python:

# video_profiler.py
from subprocess import Popen, PIPE
from plistlib import readPlistFromString
from pprint import pprint
sp = Popen(["system_profiler", "SPDisplaysDataType", "-xml"], stdout=PIPE).communicate()[0]
pl = readPlistFromString(sp)
display_status = pl[0]["_items"][0]["spdisplays_ndrvs"][0]["spdisplays_status"]
if (display_status == 'spdisplays_not_connected'): 
    card = '9400'
else:
    card = '9600'

# figure out battery status
sp = Popen(["system_profiler", "SPPowerDataType", "-xml"], stdout=PIPE).communicate()[0]
pl = readPlistFromString(sp)
on_ac_power = (pl[0]["_items"][3]["sppower_battery_charger_connected"] == 'TRUE')


if (on_ac_power and card == '9400') or (not on_ac_power and card == '9600'):
    result = 'You\'re on the wrong video card.'
else:
    result = "You\'re on the correct video card."

pprint(result)

Tags:

Macos

Macbook