Make X11 applications use the integrated GPU

Discussion in 'MacBook Pro' started by thundersteele, Feb 9, 2012.

  1. thundersteele macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #1
    Many Linux applications can be used in OSX with the help of MacPorts or other porting tools. One minor inconvenience in this process is that many of these applications use X11.app, which by default triggers a switch to the discrete GPU.

    It is relatively easy to prevent X11 from making OSX switch to the integrated GPU. The only necessary operation is to add the NSSupportsAutomaticGraphicsSwitching key to the Info.plist file inside the X11.app. The documentation for this key can be found here.

    Since X11.app is owned by the system, Xcode will not let you save the modified Info.plist file. The easiest way to get around this is to make the addition using the terminal, as follows:

    1. Quit X11, and open a Terminal.

    2. Find the location of the Info.plist file:
    Code:
    [COLOR="Red"]$[/COLOR] cd /Applications/Utilities/X11.app/Contents
    3. Open the file with an editor, e.g. emacs. You have to use "sudo" and enter your password, otherwise you won't be allowed to edit the file.
    Code:
    [COLOR="Red"]$[/COLOR] sudo emacs Info.plist
    4. Info.plist is a plain text file in xml format. After the LSMinimumSystemVersion key, modify the file such that it looks like this afterwards (i.e. add the red stuff!):
    Code:
            <key>NSPrincipalClass</key>
                    <string>X11Application</string>
            <key>LSMinimumSystemVersion</key>
                    <string>10.7.0</string>
            [COLOR="Red"]<key>NSSupportsAutomaticGraphicsSwitching</key>
                    <true/>[/COLOR]
    </dict>
    </plist>
    5. Save the file (Ctrl-X, Ctrl-S in emacs), exit the editor, and start X11. It should now stop forcing the discrete GPU on startup.


    Notes:
    Back up the Info.plist file or the whole X11.app before changing anything.
    I'm not sure how this affects X11 applications that actually need the discrete GPU.
    I remember reading about this here. It was mentioned that this could also work for other applications, but I haven't tried it yet.

    Below is a screenshot of gfxcardstatus with some running X11 applications (xterm, Xournal, xlogo).
     

    Attached Files:

  2. snaky69 macrumors 603

    Joined:
    Mar 14, 2008
    #2
    You also could've installed a small utility called gfxcardstatus and forced the intel 3000HD at all times until you need to use the ATI card.
     
  3. thundersteele thread starter macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #3
    I actually like the automated switching. I just don't want a simple text editor to trigger it. This might just be my own stupidity, but recently I had to relaunch a game because I had forgotten to change back to dynamical switching.

    The X11 application was the reason that I had started using gfxcardstatus again, so I wanted to see if there was a different way of fixing this problem. And I found one.
     

Share This Page