Overview
BoxLite uses macOS’s built-in sandbox system (Seatbelt) to isolate theboxlite-shim process. The sandbox uses SBPL (Sandbox Profile Language) policies that whitelist specific operations. When an operation is denied, macOS logs the denial to the system log.
Quick Reference
Debugging Workflow
Analyze denials
Sandbox denials appear in the format:Common denial types:
| Operation | Target | Meaning |
|---|---|---|
file-read-data | /path/to/file | Process tried to read file contents |
file-read-metadata | /path | Process tried to stat/access file metadata |
file-write-data | /path/to/file | Process tried to write to file |
file-write-create | /path/to/file | Process tried to create new file |
sysctl-read | kern.bootargs | Process tried to read sysctl value |
mach-lookup | com.apple.service | Process tried to connect to mach service |
network-outbound | *:443 | Process tried to make network connection |
iokit-open | IOHIDFamily | Process tried to access IOKit device |
Log Commands Reference
Real-time Streaming
Historical Queries
Filtering Tips
SBPL Policy Syntax
Basic Structure
Common Patterns
Testing Syntax
BoxLite Policy Files
BoxLite’s sandbox policy is split into multiple files:| File | Purpose |
|---|---|
seatbelt_base_policy.sbpl | Process ops, sysctls, mach services, IOKit |
seatbelt_file_read_policy.sbpl | Static system paths for reading |
seatbelt_file_write_policy.sbpl | Static paths for writing (/tmp) |
seatbelt_network_policy.sbpl | Network access (optional) |
macos.rs | Dynamic paths (binary, volumes, box_dir) |
Viewing the Generated Policy
To see the complete generated policy:/tmp/debug-policy.sbpl.
Common Issues
1. Changes Not Taking Effect
The.sbpl files are embedded at compile time via include_str!. After modifying them:
2. Path Canonicalization
macOS uses symlinks (/var -> /private/var, /tmp -> /private/tmp). Use canonical paths in your policy:
3. Duplicate Denials
The log may show “X duplicate reports for…”. This means the same denial happened multiple times. Fix the root cause, not each duplicate.4. Silent Failures
Some denials do not appear in logs immediately. If the process hangs or crashes without logged denials:5. Permissions vs Sandbox
Not all failures are sandbox-related. Also check:- File permissions (
ls -la) - Directory existence
- Hypervisor.framework entitlements
Debugging Checklist
Use this checklist when investigating sandbox denials:- Start log streaming before running test
- Filter logs for your process name
- Check for
deny(1)messages - Note the exact operation and target
- Add minimal rule to policy (prefer
literaloversubpath) - Document WHY the rule is needed (in comments)
- Rebuild and retest
- Verify no new denials appear