A lightweight macOS shell script that automatically monitors and manages Raycast’s memory usage. If Raycast consumes more than a defined memory threshold (default: 500 MB), the script will automatically restart the app and notify the user.
-
Monitors Raycast’s memory usage periodically
-
Automatically restarts Raycast when memory exceeds threshold
-
Sends macOS system notifications on restart (optional if IBM Notifier is installed)
-
Writes detailed logs for each check
-
Runs automatically via macOS LaunchAgent (no manual execution needed)
| Setting | Description | Default |
|---|---|---|
APP_NAME |
Application name to monitor | Raycast |
MEM_THRESHOLD_MB |
Memory threshold (in MB) before restart | 500 |
LOG_FILE |
Path to the log file | ~/raycast_mem_monitor.log |
StartInterval |
Memory check frequency | 3600 |
- Copy the script
vi ~/raycast_mem_monitor.shPaste the script content and save.
- Make it executable
chmod +x ~/raycast_mem_monitor.sh- Create the LaunchAgent
vi ~/Library/LaunchAgents/com.user.raycastmem.plistPaste the script content and change [USERNAME] to your device name.
- Load the task
launchctl load ~/Library/LaunchAgents/com.user.raycastmem.plistAll activity is logged to:
~/raycast_mem_monitor.logEach entry includes a timestamp, current memory usage, and restart actions.
If you want to use system notification, please install IBM Notifier.
-
Modify
StartIntervalto change the check frequency (e.g., 3600 = 1 hour). -
Modify
MEM_THRESHOLD_MBto meet your management needs. -
To stop the service:
launchctl unload ~/Library/LaunchAgents/com.user.raycastmem.plistMIT License — free to use and modify. Developed with ❤️ for a smoother Raycast experience.

