10

It seems I can't edit the plist file from LaunchAgents — even if I sudo, I'm prevented from any deletion/alteration. Do I have to necessarily disable SIP to do this?

  • Did you try it & see what happens? – Tetsujin Jan 13 '16 at 10:50
16

Disable the LaunchAgent (not LaunchDaemons) and reboot your machine (without sudo):

$ launchctl unload /System/Library/LaunchAgents/com.apple.gamed.plist

In case you want to enable it again at one point:

$ launchctl load /System/Library/LaunchAgents/com.apple.gamed.plist
  • 1
    it says: /System/Library/LaunchAgents/com.apple.gamed.plist: Could not find specified service I'm on 10.11.2; thanks for the suggestion! – jrgd Jan 13 '16 at 12:25
  • I just tried it on my machine and it worked fine. Same OS (10.11.2). Did you copy and paste the command from my answer? Edit: make sure to not use sudo – frdmn Jan 13 '16 at 12:26
  • yep I did; check also inside the directory and the plist file is there… did you remove SIP/rootless by any chance in the past? – jrgd Jan 13 '16 at 12:28
  • No, I haven't: paste.frd.mn/loyon - Do you see the service in launchctl list? – frdmn Jan 13 '16 at 12:32
  • 1
    You're very welcome! – frdmn Jan 13 '16 at 12:40
9

According to this thread you can do:

defaults write com.apple.gamed Disabled -bool true

And to check the current state of the daemon use:

defaults read com.apple.gamed Disabled
2

One solution is to create a bash script to stop the gamed service after you login. Use Automator in OS X to create a bash script then add it as a Login Item to your OS X account. The next time you login you should receive a prompt to execute the script. Normally I wait until I see an alert from Little Snitch that gamed is phoning home then I click 'Continue' to run the script. This has not been perfected and you may encounter issues if you run it immediately after you login to OS X. I prefer to stay away from the solutions that disable the service as those require disabling/overriding SIP which I advise against.

Here is the bash script I use. Any suggestions on improving it are welcome.

    #!/bin/bash
        chkService=gamed
        chkCount=10
        chkStatus=$(ps ax | grep "$chkService" | grep -v grep | grep " T " | wc -l)
        while [ $chkStatus -ne 1 ]; do
            chkProcess=$(ps ax | grep -v grep | grep "$chkService" | wc -l)
            if [ $chkProcess -ne 0 ];
            then
                KILLALL -STOP "$chkService"
                chkCount=0
                chkStatus=$(ps ax | grep gamed | grep -v grep | grep " T " | wc -l)
            else
                SLEEP=1
                chkCount=$((chkCount-1))
            fi
        done
2

The problem is that the accepted answer given above:

launchctl unload /System/Library/LaunchAgents/com.apple.gamed.plist

no longer works. I have also seen it using the -w flag. In any case, in recent updates, I think around El Capitan or Yosemite, you instead get a message

Operation not permitted while System Integrity Protection is engaged

System Integrity Protection is also known by the acronym SIP. To disable it you need to boot into the Recovery OS and run csrutil disable.

I have done this sequence in previous releases and it did lead to being able to disable gamed via the launchctl command.

I suppose that after gamed is disabled, one could re-enable SIP. Maybe that would be the best of both worlds, although it is a tedious process all in all.

0

what about sudo launchctl unload /System/Library/Launch\ Daemons/com.apple.gamed.plist ?

  • /System/Library/Launch Daemons/com.apple.gamed.plist: No such file or directory --- I'm on 10.11.2 (thanks for the suggestion) – jrgd Jan 13 '16 at 11:24
  • my bad, it's a LaunchAgent : sudo launchctl unload /System/Library/Launch\ Agents/com.apple.gamed.plist – PEM8000 Jan 13 '16 at 12:25
  • thanks; the directory is LaunchAgents on my machine; upon using the right path i got a "Could not find specified service" that makes me sad – jrgd Jan 13 '16 at 12:31
0

on OS Sierra go to System Settings, Internet Accounts and delete (with the minus) the Game Center on the list (left side).

  • This just deletes the Game Center account and doesn't disable the gamed process. Also, this question is about El Capitan and not Sierra. Please see How to Answer for tips on how to provide good answers to questions. - From Review – fsb May 16 '17 at 18:51
0

This makes little to no difference from a security standpoint as it simply reverts a system back to exactly ho wit worked prior to SIP, and exactly how almost all Unix systems still work. The value of SIP is at best debateable. It addresses the question because only way to use the Launchctl command to unload the gamed plist file is to first disable SIP, boot, unload the plist file, and then, if desired, reenable SIP.

0

Another option that works on 10.11.6 is a variation on the method suggested by @Le-Sci. Create a shell script that disables the gamed process:

#!/bin/bash
sleep 30 && kill -9 "$(pgrep gamed)"

The sleep command here tells the script to wait 30 seconds before starting the process of quitting gamed, to give the system enough time to have loaded gamed before trying to terminate it; you can adjust the amount of time to wait as necessary. The "kill -9" command force-quits the process you request, but it only accepts a process id number, not a process name, so "pgrep" is used to look up the process id. Make a note of where you save the script (for this example, I will save it as "forceQuitGamed" in /Users/myaccountname/ ).

Give the script execution permission:

sudo chmod +x ~/forceQuitGamed

Create a launch agent plist file that will run each time you login to your account. If you have not created a plist file before, one way you can do this is with TextEdit. The script file must be saved in plain text, so if your default preferences for TextEdit call for Rich Text formatting, do a Format>Make Plain Text command to convert to plain text before trying to use the new launch agent plist file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.myaccountname.loginscript</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/myaccountname/forceQuitGamed</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

The string in the array under "ProgramArguments" is the path/to/your/shell script. Save the file to ~/Library/LaunchAgents/ . In this example, I named the plist file com.myaccountname.forceQuitGamed.plist, so it is found at

/Users/myaccountname/Library/LaunchAgents/com.myaccountname.forceQuitGamed.plist

Now each time that you login to your account, gamed should be force-quit just a few seconds after it has loaded. (If you need it to be terminated as soon as possible after it is loaded, look at @Le-Sci's method.) This approach works without needing to disable System Integrity Protection.

-4

You have to first enter csrutil disable in Terminal when in Recovery Mode, then restart make changes, restart again in Recovery Mode and do csrutil enable, restart.

But I do not know which processes when modified will compromise boot in El Capitan

  • This enables root login. What does it have to do with gamed? – Dmitri Jun 23 '16 at 5:05
  • This is a really really bad idea from a security standpoint, and it doesn't address the question. – ruief Sep 11 '16 at 5:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .