How can I add reminders via the command line?

Solution 1:

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.

Solution 2:

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                              

Solution 3:

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);
}

Solution 4:

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}