Since upgrading to macOS Sierra (10.12.1) I’ve been having problems with the VTDecoderXPCService process spinning out of control. Closing the Messages app will fix this, but inevitably starting Messages at a later time will cause the problem to resurface. I didn’t really want to fire up IDA Pro and dig into why VTDecoderXPCService was doing this, so I instead thought I’d use cputhrottle to limit how much CPU it is allowed to consume.
You can download and compile cputhrottle yourself, or install it with brew:
brew install cputhrottle
Unfortunately VTDecoderXPCService is owned by launchd, which means cputhrottle isn’t allowed to throttle it. This is due to an error when calling task_for_pid (error 5, KERN_FAILURE). So you’ll have to disable the System Integrity Protection (SIP), sadly.
Simply reboot your machine and hold Command-R to enter recovery mode. Then start terminal and run this command:
csrutil disable; reboot
Now cputhrottle can limit VTDecoderXPCService!
I created a ruby script called limit_decoder.rb which will throttle the service for you. You could simply run this in Terminal and call it a day, or you could configure it to start with your machine. Steps to achieve this:
- Download limit_decoder.rb and save it somewhere.
- Make it executable:
chmod +x limit_decoder.rb
- Create a plist within /Library/LaunchDaemons/, mine is called com.geesu.limitdecoder.plist
- Insert the following into the above plist (change the path!):
Label com.user.loginscript Program /path/to/limit_decoder.rb RunAtLoad - Now launch the command with the following:
sudo launchctl load -w com.geesu.limitdecoder.plist
and you can unload it with:
sudo launchctl unload -w com.geesu.limitdecoder.plist
If you run into any problems you can view the /var/log/system.log for any errors.
Enjoy!