How do I programatically kill the CCLibrary process by PID?

Rather than continuously killing the processes, there's a way to uninstall Adobe's Creative Cloud application manager, mentioned in this thread.

  1. Download Adobe's Creative Cloud Cleaner from this link: http://download.macromedia.com/SupportTools/Cleaner/mac/AdobeCreativeCloudCleanerTool.dmg

  2. Then select ONLY Creative Cloud

  3. Then "uninstall selected" and reboot

And your fans will finally fall silent. The other apps still work.


I'll save the "why this is a bad idea for after the answer" but here are some tricks you might use. Since not everyone can test with CC, let's pick on Safari for this example:

ps -ef | grep "Safari "

First, I add a space after the program name to make sure it's not a part of the path. Next, use a square brackets around one character of the process name, that keeps grep from finding itself. (there's probably a more elegant way to do this, but this hack works OK for me)

ps -ef | grep "[S]afari "

This makes the grep command not match Safari - the brackets would let you search for [SZ]afari and match either Safari or Zafari for instance. We just want to mess up grep and not find alternate characters for position 1.

ps -ef | grep "[S]afari " | awk '{print $2}'

Strip out the second white space separated word to get the PID. Here's how that all looks in one session to debug the commands we are using:

mac:~ me$ ps -ef | grep Safari
  501   300     1   0 Wed06PM ??        45:03.88 /Applications/Safari.app/Contents/MacOS/Safari -psn_0_40970
  501   520     1   0 Wed06PM ??         1:08.95 /usr/libexec/SafariCloudHistoryPushAgent
  501   590     1   0 Wed06PM ??         1:39.35 /System/Library/PrivateFrameworks/SafariSafeBrowsing.framework/com.apple.Safari.SafeBrowsing.Service
  501   608     1   0 Wed06PM ??         0:10.31 /System/Library/PrivateFrameworks/SafariShared.framework/Versions/A/XPCServices/com.apple.Safari.SearchHelper.xpc/Contents/MacOS/com.apple.Safari.SearchHelper
  501  2476     1   0 Wed06PM ??         0:01.56 /System/Library/PrivateFrameworks/SafariShared.framework/Versions/A/XPCServices/com.apple.Safari.ImageDecoder.xpc/Contents/MacOS/com.apple.Safari.ImageDecoder
  501 38802     1   0 Thu01PM ??         0:02.41 /usr/libexec/SafariNotificationAgent
  501 92847 90892   0  7:27AM ttys013    0:00.00 grep Safari
mac:~ me$ ps -ef | grep "Safari "
  501   300     1   0 Wed06PM ??        45:04.31 /Applications/Safari.app/Contents/MacOS/Safari -psn_0_40970
  501 92875 90892   0  7:27AM ttys013    0:00.01 grep Safari 
mac:~ me$ ps -ef | grep "[S]afari "
  501   300     1   0 Wed06PM ??        45:04.57 /Applications/Safari.app/Contents/MacOS/Safari -psn_0_40970
mac:~ me$ ps -ef | grep "[S]afari " | awk '{ print $2 }'
300
mac:~ me$ echo kill `ps -ef | grep "[S]afari " | awk '{ print $2 }'`
kill 300

Notice I used echo to just pass the syntax of the command - if I didn't echo it, then the kill command would have actually run and killed the Safari program I'm using to write this answer.

¯\_(ツ)_/¯

So, now you should be comfortable writing a one line script to kill the one process (hopefully) and we come to the bad idea portion of the answer. It would be better to use killall server.js if you don't ever anticipate running other servers that you don't want killed.

  • What if someone makes another program or a script with the same name, now you're killing that too or killing who knows what the awk command decides to target?
  • Also, we haven't even gotten in to how to schedule the script. Do you run it every 5 minutes, once an hour, and worse, how much damage does it do to whatever work it's supposedly doing on the CPU right now.