You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to get access to Reminders in anything else than Terminal聽#68
First of all @keith, great tool, works flawlessly! 馃檹
The only caveat is that it only work directly in Terminal. If it's being called from any other application you get the "You need to grant reminders access" error generated by the app.
I've looked at #58 (it was solved through Apple Script: is too hacky for my purpose), #13 but that discussion is stale, #4 is related but too much on a programmatic level.
My request is that this app is usable by other apps than the terminal.
My assumption is that the code
`public static func requestAccess() -> Bool {
let semaphore = DispatchSemaphore(value: 0)
var grantedAccess = false
Store.requestAccess(to: .reminder) { granted, _ in
grantedAccess = granted
semaphore.signal()
}
semaphore.wait()
return grantedAccess
}
`
works in the terminal and indeed requests access to Reminders, which you can later see here:
Maybe the code can be improved to work also when being called by other apps, and in this way asks permission to the user to grant the current app permission to access Reminders, so it will show up in the list above.
(Not a Swift programmer so there are some big assumptions I made 馃槄)
thanks for the kinda words. i don't think there is anything we can do here, you'll probably just have to manually add it there if the popup doesn't happen
I think it's up to macOS to prompt for this stuff so I'm not sure why it doesn't in some cases. Maybe when we ask and it fails the app appears there but disabled?
So I tried in in different app, e.g. Visual Studio Code. It fails without showing a prompt as discussed, but then doesn't how up in the MacOS settings (shown above) unfortunately. It looks like the asking for permission in those apps is not working?
I tried debugging the ssh case a bit, the problem seems to be that the requesting process is the ssh tool. I tried codesigning the reminders-cli binary w/ the proper entitlements to see if that helped but it did not. If anyone finds a workaround for this type of case I'd love to hear it. To debug you can open Console.app, stream logs, and search for tccd. The failing lines in my case debugging ssh looked like this:
There are some unsupported ways around to try and add something to the tcc db from the command line but I haven't treid any of them https://forums.developer.apple.com/forums/thread/119373, it's possible that if you add whatever app you're launching reminders-cli from that it would start working. Let me know if you find any workarounds!
I found a workaround. It seems that reminders-cli cannot use granted permissions (I don't know why). So I've created script in nodejs
const { exec } = require('child_process');
exec(`osascript -e 'tell application "Reminders" to show (first list whose name is "blabla")'`, (error, stdout, stderr) => {
if (error) {
console.error(`Error: ${error.message}`);
return;
}
if (stderr) {
console.error(`Stderr: ${stderr}`);
return;
}
console.log(`Stdout: ${stdout}`);
});
which populate permission for current running application. For example if you run it in VSCode, then vscode will get Reminders permissions and then you can use reminders-cli directly from vscode ... 馃く
To use it in launchctl just use this script for first time
#!/bin/bash
node /path/reminders_permissions.js
then you can give permissions to nodejs executable
After that you will need to create wrapper around reminders-cli command in nodejs. For example
Kind of a stale thread, but I encountered this as well. Running bash -c reminders in kitty, instead of a direct invocation of reminders triggered the permissions prompt for kitty (macos 26.6.2).
Activity
keith commentedon Aug 29, 2023
thanks for the kinda words. i don't think there is anything we can do here, you'll probably just have to manually add it there if the popup doesn't happen
Zjaaspoer commentedon Aug 30, 2023
Hi @keith, apologies for cropping the screenshot too much, but in the full view you'll see you can't add apps manually:
(no plus in the
Compared to e.g. Full Disk Access where you can add app by using the plus in the bottom left
Non of the apps outside of terminal trigger asking for access permission
keith commentedon Aug 30, 2023
oh bummer. afaict there's no alternative API for us to be calling https://developer.apple.com/documentation/eventkit/ekeventstore?language=objc
Zjaaspoer commentedon Aug 30, 2023
Ok got it. Not an area I'm familiar with so unfortunately not something I can help with. Thanks for thinking along!
keith commentedon Aug 30, 2023
I think it's up to macOS to prompt for this stuff so I'm not sure why it doesn't in some cases. Maybe when we ask and it fails the app appears there but disabled?
Zjaaspoer commentedon Aug 31, 2023
So I tried in in different app, e.g. Visual Studio Code. It fails without showing a prompt as discussed, but then doesn't how up in the MacOS settings (shown above) unfortunately. It looks like the asking for permission in those apps is not working?
keith commentedon Nov 9, 2023
What OS version were you on with this? I started seeing this with Sonoma and have a fix
keith commentedon Nov 9, 2023
Fixed my case in #70, if 2.4.0 doesn't fix this for you please comment with the error that is now printed and we can try to find a fix.
Zjaaspoer commentedon Nov 9, 2023
Hey @keith, I'm on Sonoma too now:

Just tested again and these are the outcomes.
I have the latest version

It works perfect if I use my terminal (in this iTerm)
When I use any other program (in this case VSCode) it exits with your new error

I'm not prompted when running in VSCode to allow VSCode to access Reminders & in the privacy settings I still can't add any program manually

keith commentedon Nov 9, 2023
I guess the lack of an error in the second screenshot means There wasn't an actual error and it really is just a permissions issue.
Zjaaspoer commentedon Nov 9, 2023
Indeed, if I read the code correctly it looks like there is no error
keith commentedon Nov 9, 2023
I tried this too and see the same. Previously https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard solved this, but it doesn't seem to help in this case. It must have something to do with how VSCode spawns its terminal
rhsev commentedon Apr 16, 2024
When I access the Mac via ssh (Sonoma) and call reminder-cli, I get the same error message.
keith commentedon May 12, 2024
I tried debugging the ssh case a bit, the problem seems to be that the requesting process is the ssh tool. I tried codesigning the reminders-cli binary w/ the proper entitlements to see if that helped but it did not. If anyone finds a workaround for this type of case I'd love to hear it. To debug you can open Console.app, stream logs, and search for tccd. The failing lines in my case debugging ssh looked like this:
There are some unsupported ways around to try and add something to the tcc db from the command line but I haven't treid any of them https://forums.developer.apple.com/forums/thread/119373, it's possible that if you add whatever app you're launching reminders-cli from that it would start working. Let me know if you find any workarounds!
aizerin commentedon Aug 19, 2024
I have a similar problem but with launchctl. I have a scheduled job
with shell script
reminders_sync.shWhen I run it for test with
launchctl start com.test.todo-exportthen it will always ask for permissions in every single run and show no data.It seems that reminder-cli app is added to the reminder permissions, so I have no idea why it is not working.
When I run same script from terminal then there is no problem.
aizerin commentedon Aug 19, 2024
I found a workaround. It seems that reminders-cli cannot use granted permissions (I don't know why). So I've created script in nodejs
which populate permission for current running application. For example if you run it in VSCode, then vscode will get Reminders permissions and then you can use reminders-cli directly from vscode ... 馃く
To use it in launchctl just use this script for first time
then you can give permissions to nodejs executable
After that you will need to create wrapper around reminders-cli command in nodejs. For example
and than you can use it in bash script which you will run from launchctl. for example
馃帀馃帀馃帀馃帀馃帀馃帀
馃く馃く馃く馃く馃く馃く
btw: thanks for this tool 馃檹
Add info about reminders permissions
Add info about reminders permissions
mesveldt commentedon Sep 6, 2026
Kind of a stale thread, but I encountered this as well. Running
bash -c remindersin kitty, instead of a direct invocation ofreminderstriggered the permissions prompt for kitty (macos 26.6.2).