-
Notifications
You must be signed in to change notification settings - Fork 6
screenshot_macos.sh
Corey Watson edited this page Dec 1, 2025
·
1 revision
Captures a timestamped screenshot on macOS using the native screencapture utility.
This script provides automated screenshot capture for macOS systems, saving images with timestamped filenames to a consistent location. Designed for RMM platform integration to enable remote visual troubleshooting.
Enables remote screenshot capture for troubleshooting and monitoring purposes without user interaction. Uses the native macOS screencapture utility for silent operation without notification sounds.
- Operating System: macOS 10.12 or later
- Utilities: screencapture (standard macOS component)
- Privileges: No special privileges required (runs as user)
All settings are hardcoded in the script:
-
Save Directory:
/tmp/screenshots/ -
Filename Format:
screenshot_YYYYMMDD_HHMMSS.png - Image Format: PNG
- Capture Mode: Silent (no sound)
No parameters required - all settings are embedded in the script.
-
Directory Creation:
- Checks if
/tmp/screenshots/exists - Creates directory if needed using
mkdir -p
- Checks if
-
Timestamp Generation:
- Creates timestamp in format
YYYYMMDD_HHMMSS - Example:
20250601_143022
- Creates timestamp in format
-
Screenshot Capture:
- Uses
screencapture -xfor silent capture - Captures entire screen
- Saves to
/tmp/screenshots/screenshot_[timestamp].png
- Uses
-
Verification:
- Reports success and full file path
- Returns exit code 0 on success
The script exits immediately on any error due to set -euo pipefail.
- No special privileges required
- Saves to
/tmp/directory (cleared on reboot) - No network access or data transmission
- Screenshot contains visible screen content at time of capture
- Files stored unencrypted in temporary directory
- RMM platform should retrieve and delete screenshots promptly
- 0: Screenshot captured successfully
-
1: Screenshot capture failed:
- screencapture utility failed
- Unable to create save directory
- Disk full or write error
[ SCREENSHOT CAPTURE - macOS ]
--------------------------------------------------------------
Creating screenshot directory...
Capturing screenshot...
[ FINAL STATUS ]
--------------------------------------------------------------
Result : SUCCESS
Saved to : /tmp/screenshots/screenshot_20250601_143022.png
[ SCRIPT COMPLETED ]
--------------------------------------------------------------
-
v1.0.0: Initial release
- Silent screenshot capture
- Timestamped filenames
- RMM-compatible output location
- Automatic directory creation
- View Script Source
- Scripts - Back to script index