Skip to content

Instantly share code, notes, and snippets.

@jivanpal
Last active August 6, 2023 17:23
Show Gist options
  • Star 47 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save jivanpal/30af7741721e597575e10f5ef8560062 to your computer and use it in GitHub Desktop.
Save jivanpal/30af7741721e597575e10f5ef8560062 to your computer and use it in GitHub Desktop.
Stop Adobe Creative Cloud daemons (background processes) in their tracks
#!/bin/bash
if [ "$1" = "-s" ] || [ "$1" = "--show" ]; then
show=true
else
show=false
fi
if $show || [ "$1" = "-v" ] || [ "$1" = "--verbose" ]; then
verbose=true
else
verbose=false
fi
kill_list=""
for i in $(pgrep -i adobe); do
if $verbose; then
echo -n "PID $i -- "
ps -p "$i" -o command $($show || echo -c) | awk 'ORS=""; NR==2'
fi
ps -p "$i" -o command | awk 'NR==2' | grep -E '^/Applications/Adobe XD/Adobe XD\.app/Contents/MacOS/Adobe XD$' > /dev/null
if [ $? -eq 1 ] ; then
$verbose && echo " -- KILL"
kill_list="$kill_list $i"
else
$verbose && echo " -- KEEP ALIVE"
fi
done
if [ -z "$kill_list" ] ; then
$verbose && echo "Nothing to kill"
else
if $verbose; then
echo "KILL_LIST = $kill_list"
set -x
fi
$show || sudo kill -TERM $kill_list
fi
@jivanpal
Copy link
Author

jivanpal commented Sep 25, 2020

A simple Bash script intended for Adobe Creative Cloud users that kills its needlessly resource-intensive background processes (particularly Adobe Desktop Service and Core Sync) by:

  1. using pgrep to find processes with "adobe" (case insensitive) in the name; and then
  2. killing all of those which aren't Adobe XD (since that's the only Adobe app that I use).

I removed Adobe's launchd services from the following directories:

  • /Library/LaunchAgents
  • /Library/LaunchDaemons
  • ~/Library/LaunchAgents

Then I put this script in a cronjob that runs every 5 minutes. The sudo on line 40 obviously isn't needed when in a cronjob that runs as root.

After removing Adobe's launchd services, it seems that the processes I want to kill are only launched when Adobe XD itself is launched, so rather than having a 5-minute cronjob that does nothing almost all of the time, it would make more sense to have a launchd service which runs this script whenever Adobe XD is launched; or whenever an offending app is launched, but that seems more difficult. I would be grateful if anyone who knows launchd better than I do could create such a .plist.

If you want to see the PIDs and names of the processes that the script finds, and which of those it decides to kill, you can use the -v or --verbose option.

@hrvstr
Copy link

hrvstr commented Nov 23, 2020

Would it be possible to extend this script for more apps than just XD? I use quite a lot of Adobe apps...

@jivanpal
Copy link
Author

jivanpal commented Nov 24, 2020

@hrvstr, modify the grep on line 17 (now line 23, I've edited the script) as appropriate, e.g. if you use PhotoShop and XD, something like the following:

ps -p "$i" -o command | awk 'NR==2' | grep -E '^/Applications/Adobe (XD|PhotoShop)/Adobe (XD|PhotoShop)\.app/Contents/MacOS/Adobe (XD|PhotoShop)$' > /dev/null

I don't know the actual paths for anything other than XD, though, and don't fancy installing each app to find out/confirm my guess, so the above is just indicative.

I've modified the script so you can run it with --show or -s to just show the full paths of all the found processes and the arguments they were called with, e.g. ./kill-adobe-daemons.sh --show.

Doing that on my system with XD running, for example, gives me the following:

PID 502 -- /Library/Application Support/Adobe/Adobe Desktop Common/IPCBox/AdobeIPCBroker.app/Contents/MacOS/AdobeIPCBroker -launchedbyvulcan /Applications/Utilities/Adobe Creative Cloud/ACC/Creative Cloud.app/Contents/MacOS/Creative Cloud -- KILL
PID 525 -- /Library/Application Support/Adobe/Adobe Desktop Common/ADS/Adobe Desktop Service.app/Contents/MacOS/Adobe Desktop Service --onOSstartup=true --showwindow=false -- KILL
PID 559 -- /Library/Application Support/Adobe/Adobe Desktop Common/ADS/Adobe Desktop Service.app/Contents/Frameworks/AdobeCrashReporter.framework/Versions/A/AdobeCRDaemon.app/Contents/MacOS/AdobeCRDaemon 525 Adobe Desktop Service 5.3.1 /Library/Application Support/Adobe/Adobe Desktop Common/ADS/Adobe Desktop Service.app/Contents/Resources/CreativeCloudApp.icns /Library/Application Support/Adobe/Adobe Desktop Common/ADS/Adobe Desktop Service.app/Contents/Frameworks/AdobeCrashReporter.framework/Versions/A/Adobe Crash Reporter.app/Contents/MacOS/Adobe Crash Reporter 0      5.3.1 5.3.1.470   Adobe Desktop Service 1 1 1 0  8.0.6 -- KILL
PID 568 -- /Library/PrivilegedHelperTools/com.adobe.acc.installer.v2 -- KILL
PID 573 -- /Library/Application Support/Adobe/Adobe Desktop Common/ElevationManager/Adobe Installer --pipename=E4A4A4F3-AA77-4CFD-8E5B-37E3048EF021 -- KILL
PID 578 -- /Applications/Utilities/Adobe Creative Cloud Experience/CCXProcess/CCXProcess.app/Contents/MacOS/../libs/Adobe_CCXProcess.node /Applications/Utilities/Adobe Creative Cloud Experience/CCXProcess/CCXProcess.app/Contents/MacOS/../js/main.js -- KILL
PID 2079 -- /Applications/Adobe XD/Adobe XD.app/Contents/MacOS/Adobe XD -- KEEP ALIVE

The output contains arguments passed to each running app found by the search, so you will need to remove any that are present, e.g. if I wanted to keep Adobe Installer running, I'd look at the following line:

PID 573 -- /Library/Application Support/Adobe/Adobe Desktop Common/ElevationManager/Adobe Installer --pipename=E4A4A4F3-AA77-4CFD-8E5B-37E3048EF021 -- KILL

It's fairly clear from that output that the path is /Library/Application Support/Adobe/Adobe Desktop Common/ElevationManager/Adobe Installer; the --pipename stuff is an argument passed to the app. Thus, to also have that kept alive, I'd change the grep line to read:

ps -p "$i" -o command | awk 'NR==2' | grep -E '^(/Applications/Adobe XD/Adobe XD\.app/Contents/MacOS/Adobe XD|/Library/Application Support/Adobe/Adobe Desktop Common/ElevationManager/Adobe Installer)( |$)' > /dev/null

There, I've changed the $ at the end to ( |$) so that it doesn't matter whether a particular app is called with or without any arguments; that regex handles both cases.

Running with --show after making that modification then shows the same output, except the line for Adobe Installer says -- KEEP ALIVE instead of -- KILL at the end, confirming what it will do when run without --show.


You could also just be very loose with the regex used by grep for the matching search, using something like:

ps -p "$i" -o command | awk 'NR==2' | grep -Ei 'Adobe (XD|PhotoShop)' > /dev/null

The -E is changed to -Ei there so that the grep is case-insensitive. Thus, if you get the casing of Photoshop/PhotoShop wrong, for example, it doesn't matter. The only potential caveat of using a loose search like this is that there might be other processes with both "adobe" and "photoshop" in their path/arguments (I don't know if this will actually be the case for whatever CC apps you're running), so you run the risk of matching those and keeping them, which may be undesirable.


Perhaps a better way to do things is to use -c in the ps that's passed to the grep which actually does the matching, too, so that only the name of the executable itself is needed. The following might then do exactly what you need:

ps -p "$i" -o command -c | awk 'NR==2' | grep -Ei '^Adobe (XD|PhotoShop)$' > /dev/null

(Apologies for the extremely long comment, this was just a stream of consciousness, really.)

@alemens
Copy link

alemens commented Jun 15, 2021

Hi @jivanpal here my contribute with some real path. See if you need more

Adobe Applications path

Acrobat DC

realpath ~/Applications/Adobe Acrobat DC/Adobe Acrobat.app
~ cd /Applications/Adobe\ Acrobat\ DC 
➜  ~ pwd
/Applications/Adobe Acrobat DC
➜  ~ ls -lah
total 176
drwxrwxr-x@  6 root  wheel   192B Jun 10 18:26 .
drwxrwxr-x  30 root  admin   960B Jun 11 23:48 ..
drwxrwxr-x   3 root  wheel    96B Oct  3  2019 Acrobat Distiller.app
-rw-r--r--@  1 root  wheel   1.1K Jun 10 18:26 Acrobat Uninstaller
drwxrwxr-x   3 root  wheel    96B Jun 10 18:26 Adobe Acrobat.app
-rw-r--r--@  1 root  wheel     0B Jun 10 18:26 Icon?~ realpath /Applications/Adobe\ Acrobat\ DC/Adobe\ Acrobat.app                 
/Applications/Adobe Acrobat DC/Adobe Acrobat.app

Creative Cloud (note is a redirect into a more complex structure)

realpath ~/Applications/Utilities/Adobe Creative Cloud/ACC/Creative Cloud.app
~ cd /Applications/Adobe\ Creative\ Cloud 
➜  ~ pwd
/Applications/Adobe Creative Cloud
➜  ~ ls -lah
total 200
drwxr-xr-x@  6 root  admin   192B May 12 05:47 .
drwxrwxr-x  30 root  admin   960B Jun 11 23:48 ..
lrwxr-xr-x   1 root  admin    82B Oct  3  2019 .Uninstall Adobe Creative Cloud_bkp -> /Applications/Utilities/Adobe Creative Cloud//Utils/Creative Cloud Uninstaller.app
lrwxr-xr-x   1 root  admin    67B May 12 05:47 Adobe Creative Cloud -> /Applications/Utilities/Adobe Creative Cloud/ACC/Creative Cloud.app
-rw-r--r--@  1 root  admin     0B May 12 05:47 Icon?
lrwxr-xr-x   1 root  admin    82B Oct  3  2019 Uninstall Adobe Creative Cloud -> /Applications/Utilities/Adobe Creative Cloud//Utils/Creative Cloud Uninstaller.app
➜  ~ realpath /Applications/Adobe\ Creative\ Cloud/Adobe\ Creative\ Cloud 
/Applications/Utilities/Adobe Creative Cloud/ACC/Creative Cloud.app

Photoshop 2021

realpath ~/Applications/Adobe Photoshop 2021/Adobe Photoshop 2021.app
~ cd /Applications/Adobe\ Photoshop\ 2021 
➜  ~ pwd
/Applications/Adobe Photoshop 2021
➜  ~ ls -lah
total 160
drwxr-xr-x@  9 root  wheel   288B Jun 13 03:30 .
drwxrwxr-x  30 root  admin   960B Jun 11 23:48 ..
drwxr-xr-x   3 root  wheel    96B Jun 13 03:29 Adobe Photoshop 2021.app
drwxr-xr-x   3 root  wheel    96B Jun 13 03:29 Configuration
-rw-r--r--@  1 root  wheel     0B Jun 13 03:30 Icon?
drwxr-xr-x   3 root  wheel    96B May 18 10:58 Locales
drwxr-xr-x@  4 root  wheel   128B Jun 13 03:30 Plug-ins
drwxr-xr-x  39 root  wheel   1.2K Jun 13 03:30 Presets
-rw-r--r--@  1 root  wheel   948B Jun 13 03:30 Uninstall Adobe Photoshop 2021
➜  ~ realpath /Applications/Adobe\ Photoshop\ 2021/Adobe\ Photoshop\ 2021.app 
/Applications/Adobe Photoshop 2021/Adobe Photoshop 2021.app

Utilities folder structure

Because Creative Cloud has redirect, tell us if you need any other real path
~ cd /Applications/Utilities
➜  ~ pwd
/Applications/Utilities
➜  ~ ls -lah
total 0
drwxr-xr-x   9 root  wheel   288B Jun  9 01:31 .
drwxrwxr-x  30 root  admin   960B Jun 11 23:48 ..
-rw-r--r--   1 root  wheel     0B Jan  1  2020 .localized
drwxr-xr-x  14 root  wheel   448B May 12 05:47 Adobe Application Manager
drwxr-xr-x   8 root  wheel   256B May 12 05:47 Adobe Creative Cloud
drwxrwxr-x   3 root  wheel    96B Jun  9 01:31 Adobe Creative Cloud Experience
drwxr-xr-x   4 root  wheel   128B Apr 23 22:15 Adobe Genuine Service
drwxrwxr-x   4 root  admin   128B Jun 13 03:30 Adobe Installers
drwxrwxr-x   5 root  wheel   160B Jun  8 01:35 Adobe Sync

@zang74
Copy link

zang74 commented Sep 28, 2021

So, I've tweaked what I believe is a better catch-all GREP for many Creative Cloud apps, based on standard adobe installations and naming conventions.

ps -p "$i" -o command | awk 'NR==2' | grep -E '^\/Applications\/(Adobe( (\w)+)+)( [0-9]{4})?\/Adobe( (\w)+)+( [0-9]{4})?\.app\/Contents\/MacOS\/(\1|AdobeAcrobat|After Effects)$'

@hrvstr
Copy link

hrvstr commented Sep 29, 2021

So, I've tweaked what I believe is a better catch-all GREP for many Creative Cloud apps, based on standard adobe installations and naming conventions.

ps -p "$i" -o command | awk 'NR==2' | grep -E '^\/Applications\/(Adobe( (\w)+)+)( [0-9]{4})?\/Adobe( (\w)+)+( [0-9]{4})?\.app\/Contents\/MacOS\/(\1|AdobeAcrobat|After Effects)$'

This seems to work really well. The only thing I noticed is that it didn't catch CCLibrary.app.

@HarithSami
Copy link

How can I undo the script?

@bardtian
Copy link

bardtian commented Jun 3, 2022

I did simply rename "CCXProcess.app" to "CCXProcess-.app", and it works.
No adobecrdaemon is keeping running now.
I am using iMac.

@jivanpal
Copy link
Author

jivanpal commented Jun 17, 2022

@HarithSami The script just kills currently running processes, it doesn't make any permanent changes to the system configuration, so there is nothing to undo. If you restart Creative Cloud or just open one of the Creative Cloud apps, the daemons should be started again.

@Mr-Sheep
Copy link

Here's a really great kill-apps helper from sunknudsen/privacy-guides that can be added to .zshrc:

# Kill apps that match string
function kill-apps() {
  IFS=$'\n'
  red=$(tput setaf 1)
  normal=$(tput sgr0)
  if [ -z "$1" ] || [ "$1" = "--help" ]; then
    printf "%s\n" "Usage: kill-apps string"
    return 0
  fi
  printf "%s\n" "Finding apps that match “$1”…"
  sleep 1
  processes=($(pgrep -afil "$1"))
  if [ ${#processes[@]} -eq 0 ]; then
    printf "%s\n" "No apps found"
    return 0
  else
    printf "%s\n" "${processes[@]}"
    printf "$red%s$normal" "Kill found apps (y or n)? "
    read -r answer
    if [ "$answer" = "y" ]; then
      printf "%s\n" "Killing found apps…"
      sleep 1
      for process in "${processes[@]}"; do
        echo $process | awk '{print $1}' | xargs sudo kill 2>&1 | grep -v "No such process"
      done
      printf "%s\n" "Done"
      return 0
    fi
  fi
}

paste above script into ~/.zshrc and then run source ~/.zshrc. Then you can just use commands like kill-apps adobe to kill all adobe related stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment