CalendarLib EC issue via osascript in Sonoma

I’m running macOS Sonoma nd I’m seeing an issue when running scripts from the terminal via osascript. A script will run in Script Editor, but fail when I run it as a saved file (osascript test.scpt) or concatenated to statements (osascript -e 'use framework "Foundation"' -e...).

I wish I got a more helpful error, but all I’m seeing is Segmentation fault: 11, which seems to be related to memory access.

Here’s a simple script to add a calendar event that fails via osascript:

use framework "Foundation"
use script "CalendarLib EC" version "1.1.5"
use scripting additions
set theStore to fetch store
set theCal to fetch calendar "My Calendar" cal type cal cloud event store theStore
set theEvent to create event event store theStore destination calendar theCal event summary "New Event" starting date (current date) ending date (current date) with runs all day
store event event theEvent event store theStore

I have encountered the same problem. It seems to crash at the set theStore to fetch store statement.

@ShaneStanley any chance to fix the issue?

It’s working here, but you need to give Script Debugger (or osascript in the first post) Full Access to your calendars.

Thank you for help. I don’t see how can I grant the calendar access to osascript. Do you have any suggestion, how to do so? I could only give access to apps such as Terminal, from which I run osascript.

I’ve tested the script with Terminal and Keyboard Maestro (both of which have Full Access to my calendars), and the script still crashes at the same statement. The same script runs fine in Script Editor.

Alas, I don’t – sorry.