21

Once in a while it may be useful to add some reminders to Reminders.app from the command line — especially because they are synced to iCloud. Is there any way to do so?

A solution that does not rely on AppleScript is preferred: a) for performance reasons (probably silly) and b) AppleScript solutions often feel clumsy or overly verbose to me.

1
  • 2
    Why do you prefer not to use AppleScript?
    – Daniel
    Commented Oct 11, 2012 at 1:24

5 Answers 5

9
osascript - title <<END
on run a
tell app "Reminders"
tell list "Reminders" of default account
make new reminder with properties {name:item 1 of a}
end
end
end
END

You could also create an Automator workflow with just an empty New Reminders Item action and then run it with automator -i title test.workflow.

See also this post at Mac OS X Hints.

4
  • Thank you for your answer. Unfortunately, this does not run in either a shell script or in Script Editor. What am I missing?
    – myhd
    Commented Oct 11, 2012 at 7:27
  • 1
    Either add #!/usr/bin/env bash as the first line and run chmod +x /path/to/script, or run bash /path/to/script.sh. Or remove the first and last lines and save it AppleScript Editor.
    – Lri
    Commented Oct 11, 2012 at 15:43
  • 1
    The Automator hint did the trick! In contrast to the AppleScript solution it does not need to launch the Reminders.app, which is exactly what I wanted.
    – myhd
    Commented Oct 16, 2012 at 9:00
  • Where can I find some docs about the supported applications and what I can tell them?
    – faressoft
    Commented Feb 6, 2020 at 13:54
16

Here's another version that allows you to set the title, end date and time via command line arguments.

#!/usr/bin/env bash                                                                                                               
# Make a new reminder via terminal script                                                                                         
# args: remind <title> <date> <time>                                                                                                                                                                                 

osascript - "$1" "$2" "$3" <<END                                                                                                        
on run argv                                                                                                                       
    set stringedAll to date (item 2 of argv & " " & item 3 of argv)                                                               
    tell application "Reminders"                                                                                                  
        make new reminder with properties {name:item 1 of argv, due date:stringedAll}                                             
    end tell                                                                                                                      
end run                                                                                                                           
END    

So if you were to name this script "remind" and give it executing privileges (chmod 755 remind), you could do this:

$ ./remind "Go to grocery store" 12/15/2013 10:00:00PM                              
1
  • This works for me, but how can I add an alarm. That is how can I make it actually popup and remind me at the date and time of the reminder? As it is, I have a reminder, but do not receive a notification. Commented Aug 18, 2016 at 5:30
5

Here's the same functionality as the above AppleScript; but in JXA with ES6.

#!/usr/bin/env osascript -l JavaScript

const RemindersApp = Application('Reminders');

function run(argv) {
    [name, date, time] = argv;
    dueDate = new Date(date + " " + time);
    reminder = RemindersApp.Reminder({name: name, dueDate: dueDate});
    RemindersApp.defaultList.reminders.push(reminder);
}
2
  • Where can I find some docs about the supported applications and the methods?
    – faressoft
    Commented Feb 6, 2020 at 13:54
  • @faressoft: launch Script Editor app, choose "File > Open dictionary…" and choose the application. Commented Mar 13, 2023 at 6:28
2
tell application "Reminders"
    activate
    show list "Reminders"
end tell
set stringedDate to "12/11/2015"
set stringedHour to "10:00:00PM"
set stringedAll to date (stringedDate & " " & stringedHour)
tell application "Reminders" to tell list "Reminders" of default account to make new reminder with properties {name:"this is just test remainder", remind me date:stringedAll, due date:stringedAll, priority:1}
2
  • 1
    Hi, thanks! This does only work on Systems where English is the User Interface language. In other Languages, a the list names are localized, e.g. "Reminders" becomes "Erinnerungen" in German
    – myhd
    Commented Apr 7, 2015 at 13:32
  • This example actually illustrates the use of the "remind me date" as opposed to the "due date" above. And the "remind me date" is exactly what one wants to use to get the alarm/alert.
    – Grrrr
    Commented Aug 31, 2016 at 11:19
2

This github project works great, and doesnt use AppleScript. It's a compiled XCode app.

https://github.com/keith/reminders-cli

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .