ajrosen / icalPal

Command-line tool to query the macOS Calendar and Reminders
GNU General Public License v3.0
11 stars 2 forks source link

icalPal in Cron #4

Open Porco-Rosso opened 11 months ago

Porco-Rosso commented 11 months ago

Hi, firstly thanks for developing this spiritual successor to iCalBuddy, really makes my upcoming project a lot easier because of the JSON output.

However, I am having trouble running icalPal with Cron on MacOS.

Previously I got around this issue by bundling my script in a .app, but was wondering if there might be a way to make it work natively with iCalPal?

ajrosen commented 10 months ago

The issue might be, as with icalBuddy, that MacOS does not see icalPal requesting access to the Calendar. If cron is calling icalPal then MacOS will check cron's permission to access your Calendar or Library folder.

Porco-Rosso commented 10 months ago

I was also thinking it might be because cron is run as root, and not as the user? Therefore the user's calendar is missing?

I see the option --db=DB Use DB file instead of Calendar But not entirely sure what that means. Is there a way to point icalPal Directly to the calendar app database? That may be a fix.

ajrosen commented 10 months ago

Hmm, maybe. I hadn't thought of that.

icalPal actually doesn't use an API; it only reads a calendar database file. The default file is ${HOME}/Library/Calendars/Calendar.sqlitedb.

Porco-Rosso commented 10 months ago

So while using --db=/Users/myusername/Library/Calendars/Calendar.sqlitedb works, it still doesn't work in crontab. I'll keep playing around, but it seems at the moment the only option seems to be wrapping the script in a .app