145 lines
4.7 KiB
Markdown
Raw Permalink Normal View History

2021-01-05 06:22:25 -05:00
<!--
2021-01-05 08:30:26 -05:00
Title: How to make sure app is not running in the background on macOS
Description: Learn how to how to make sure app is not running in the background on macOS.
2021-01-05 06:22:25 -05:00
Author: Sun Knudsen <https://github.com/sunknudsen>
Contributors: Sun Knudsen <https://github.com/sunknudsen>
Reviewers:
Publication date: 2021-01-04T15:53:29.749Z
Listed: true
2023-09-06 19:23:39 -04:00
Pinned:
2021-01-05 06:22:25 -05:00
-->
2021-01-05 08:30:26 -05:00
# How to make sure app is not running in the background on macOS
2021-01-05 06:22:25 -05:00
2023-09-06 19:28:21 -04:00
[![How to make sure app is not running in the background on macOS](how-to-make-sure-app-is-not-running-in-the-background-on-macos.jpg)](https://www.youtube.com/watch?v=mSibcNslSK8 "How to make sure app is not running in the background on macOS")
## Requirements
- Computer running macOS Catalina or Big Sur
2021-01-05 06:22:25 -05:00
## Caveats
- When copy/pasting commands that start with `$`, strip out `$` as this character is not part of the command
- When copy/pasting commands that start with `cat << "EOF"`, select all lines at once (from `cat << "EOF"` to `EOF` inclusively) as they are part of the same (single) command
## Setup guide
> Heads-up: following steps illustrate how to make sure “Adobe Creative Suite” is not running in the background, but same logic should apply any app.
### Step 1: find app launch agent and daemon bundle identifier prefix
```console
2021-04-05 19:44:58 -04:00
$ ls -A1 {,~}/Library/LaunchAgents /Library/LaunchDaemons
/Library/LaunchAgents:
2021-01-05 06:22:25 -05:00
at.obdev.LittleSnitchHelper.plist
at.obdev.LittleSnitchUIAgent.plist
com.adobe.ARMDCHelper.cc24aef4a1b90ed56a725c38014c95072f92651fb65e1bf9c8e43c37a23d420d.plist
com.adobe.AdobeCreativeCloud.plist
com.adobe.GC.AGM.plist
com.adobe.GC.Invoker-1.0.plist
com.adobe.ccxprocess.plist
/Library/LaunchDaemons:
at.obdev.littlesnitchd.plist
com.adobe.ARMDC.Communicator.plist
com.adobe.ARMDC.SMJobBlessHelper.plist
com.adobe.acc.installer.v2.plist
com.adobe.agsservice.plist
com.apple.installer.osmessagetracing.plist
local.pf.plist
local.pmset.plist
local.spoof.plist
org.virtualbox.startup.plist
org.wireshark.ChmodBPF.plist
/Users/sunknudsen/Library/LaunchAgents/:
com.adobe.GC.Invoker-1.0.plist
local.borg-wrapper.plist
org.virtualbox.vboxwebsrv.plist
```
com.adobe
👍
### Step 2: disable app launch agents and daemons
> Heads-up: dont worry if you see “Could not find specified service” warnings.
```shell
BUNDLE_IDENTIFIER_PREFIX="com.adobe"
2021-04-05 18:28:39 -04:00
sudo launchctl unload -w /Library/{LaunchAgents,LaunchDaemons}/$BUNDLE_IDENTIFIER_PREFIX*.plist
2021-04-05 19:44:58 -04:00
launchctl unload -w {,~}/Library/LaunchAgents/$BUNDLE_IDENTIFIER_PREFIX*.plist
2021-01-05 06:22:25 -05:00
```
### Step 3: disable app extensions
2021-04-05 09:30:38 -04:00
Open “System Preferences”, click “Extensions” and disable app extensions (if any).
2021-01-05 06:22:25 -05:00
2023-09-06 19:29:50 -04:00
![core-sync](./core-sync.png)
2021-01-05 06:22:25 -05:00
### Step 4: add `kill-apps` helper to `.zshrc`
> Heads-up: following step assumes macOS is configured to use “Z shell” (running `echo $SHELL` should return `/bin/zsh`).
```shell
cat << "EOF" >> ~/.zshrc
# Kill apps that match string
function kill-apps() {
2021-01-08 14:20:31 -05:00
IFS=$'\n'
2021-03-16 14:23:21 -04:00
red=$(tput setaf 1)
normal=$(tput sgr0)
2021-05-03 07:40:09 -04:00
if [ -z "$1" ] || [ "$1" = "--help" ]; then
2021-01-05 06:22:25 -05:00
printf "%s\n" "Usage: kill-apps string"
2021-05-01 07:09:23 -04:00
return 0
2021-01-05 06:22:25 -05:00
fi
2021-04-04 07:27:10 -04:00
printf "%s\n" "Finding apps that match “$1”…"
2021-01-08 14:20:31 -05:00
sleep 1
processes=($(pgrep -afil "$1"))
if [ ${#processes[@]} -eq 0 ]; then
printf "%s\n" "No apps found"
return 0
else
printf "%s\n" "${processes[@]}"
2021-03-16 14:23:21 -04:00
printf "$red%s$normal" "Kill found apps (y or n)? "
2021-01-08 14:20:31 -05:00
read -r answer
if [ "$answer" = "y" ]; then
2021-03-16 14:23:21 -04:00
printf "%s\n" "Killing found apps…"
2021-01-08 14:20:31 -05:00
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
2021-01-05 06:22:25 -05:00
fi
}
EOF
source ~/.zshrc
```
👍
2021-06-21 09:07:17 -04:00
---
2021-01-05 06:22:25 -05:00
## Usage guide
### Make sure “Adobe Creative Suite” is not running in the background
```console
$ kill-apps adobe
2021-03-16 14:23:21 -04:00
Finding apps that match "adobe"…
2021-01-05 06:22:25 -05:00
46639 /Library/Application Support/Adobe/Adobe Desktop Common/IPCBox/AdobeIPCBroker.app/Contents/MacOS/AdobeIPCBroker -launchedbyvulcan /Applications/Adobe Premiere Pro 2020/Adobe Premiere Pro 2020.app/Contents/MacOS/Adobe Premiere Pro 2020
46645 /Library/Application Support/Adobe/Creative Cloud Libraries/CCLibrary.app/Contents/MacOS/../libs/node /Library/Application Support/Adobe/Creative Cloud Libraries/CCLibrary.app/Contents/MacOS/../js/server.js
46653 /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
46655 /Applications/Adobe Premiere Pro 2020/Adobe Premiere Pro 2020.app/Contents/MacOS/LogTransport2.app/Contents/MacOS/LogTransport2 86E222CE52861AEA0A490D4D@AdobeID 1 0 NOVALUE NOVALUE
Kill found apps (y or n)? y
2021-01-05 06:22:25 -05:00
Password:
Done
```
Done
👍