Programmatically change Mac display brightness
问题 How to change Mac display brightness from cocoa application? 回答1: CGDisplayIOServicePort is deprecated in OS 10.9 – so you have to use IOServiceGetMatchingServices to get the service parameter for IODisplaySetFloatParameter . Here's a basic function that looks for services named "display" and changes their brightness. - (void) setBrightnessTo: (float) level { io_iterator_t iterator; kern_return_t result = IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceMatching("IODisplayConnect")