Keeps the Google Chat desktop app always open on macOS. If it crashes or you
close it by accident, launchd reopens it automatically — in the background,
without stealing focus (unlike a plain open -a, which pops the window to front
every time).
No script and no config file: a single launchd agent with KeepAlive does the
whole job.
-
Create the LaunchAgents folder (if it doesn't exist):
mkdir -p ~/Library/LaunchAgents -
Add the agent at
~/Library/LaunchAgents/com.user.googlechat.plist(seecom.user.googlechat.plist).⚠️ If your Google Chat is a Chrome PWA, it may be named likeGoogle Chat 1. Check your exact name and put it in the plist:ls /Applications | grep -i "google chat"
-
Load the agent:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.user.googlechat.plist
Done. Google Chat now stays open and reopens itself if closed or crashed.
Check status:
launchctl print gui/$(id -u)/com.user.googlechat | grep stateTurn it off (this is also how you actually quit the app for good):
launchctl bootout gui/$(id -u)/com.user.googlechatTurn it back on:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.user.googlechat.plist- Works with the official Google Chat desktop app and with Chrome PWA installs — just match the exact app name in the plist.
open -g -W -akeeps the app in the background:-g= don't bring to front,-W= wait until it exits soKeepAlivecan respawn it cleanly.- While the agent is loaded you can't fully quit Google Chat (it reopens
instantly). Unload the agent first (
launchctl bootout …) when you really want it closed. - Want it running only during work hours instead of 24/7? See the companion "Discord work-hours" gist for the scheduled-watcher pattern.