This is a small Swift script that compiles into a binary to display upcoming events from the macOS Calendar app. It's designed for integration with SketchyBar but can be used anywhere.
Unlike tools like iCalBuddy, this script avoids common macOS TCC (Transparency, Consent, and Control) permission issues by using the native EventKit framework.
You only need to compile the Swift script once:
swiftc CalendarEvents.swift -o ~/.config/sketchybar/calendar_events
You can change the output path or binary name as needed.
Create a calendars.txt
file in the same directory as the compiled script, listing the names of the calendars you want to include β one per line:
calendar A
calendar B
Only events from calendars listed in this file will be shown. If this file is not present, all calendars will be used.
You can pass the number of days to fetch as a command-line argument when running the compiled binary. For example, to fetch events for today and the next 2 days (3 days total):
~/.config/sketchybar/calendar_events 3
If no argument is provided, the default is 1 (only today). See my sketchybar config for an example of this.
The binary prints upcoming events to stdout in this format:
09:00β10:00 | Daily Standup
14:30β15:00 | Design Review
Use the output as input for your SketchyBar plugin or other automation scripts. Enjoy a TCC-free, native way to display calendar events on your Mac!
To list all available calendar names (to help you build calendars.txt), uncomment the debug print section in the script:
for cal in store.calendars(for: .event) {
print("- \(cal.title)")
}
Then recompile and run the binary to see the output.