So I'd like to edit a plist file property using automator. I need to change the value of a key so that it's set to 1 minute before the automator app was launched. I'm quite new to all this and I need help...

For a said SULastCheckTime, I would need the value to be set to Jun 1, 2017, 8:52:56 PM if the automator app was launched at 8:53 on June 1st 2017...


1 Answer 1


You need to add a shell script action to your automator script, and do the actual setting in the shell script. I don't believe its possible to obtain the start time of the automator script, so you'll have to settle with a time stamp relative to the time when the shell script is executed. If you really need the start time, you'll have to add an action to record it yourself as the first step in the automator script.

In the shell, time computation is done with date.

date -v 1M

gives you the time one minute ago. If you really need it formatted in the specific way that you give above, you need to format it yourself, like so

date -v -1M '+%b %d, %Y, %H:%M:%S %p'

Here, %b, %d etc are place holders for the various timestamp components; see the man page for strftime.

Next, you need to know how to change a plist file. You can use plutil for that, like so

plutil -replace SULastCheckTime -string newvalue foo.plist

Putting it all together, the shell script could read

time=`date -v -1M '+%b %d, %Y, %H:%M:%S %p'`
plutil -replace SULastCheckTime -string "$time" foo.plist

Here, the backticks take the output of date and put it in a variable time; plutil then puts it in a file.

If you are going to use shell scripts anyway, you may consider dropping automator altogether in favor of shell scripts.

You must log in to answer this question.

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