I have a macro that takes quite a long time to complete. It iterates over all the tags on my system, and involves querying the Shell. I’ve always set this to run at 2am, which was working fine under Yosemite.

However, since upgrading to macOS Sierra, the macro runs for about 15 minutes, but then it stops working (returns an empty result from the Shell). Annoyingly, this happens at different points through the macro every time.

Does anyone have any thoughts why this would be? Is there something that has changed about Sierra and shell scripts that anyone knows of?

The Shell script is here:

mdfind -onlyin $KMVAR_rcPath -0 “(kMDItemUserTags == ‘*’)” |xargs -0 mdls -name kMDItemUserTags |grep '^ ’ |cut -c5- |cut -d , -f 1 |sort -u

Many thanks for any help in advance.

On a quick try your shell script works here. However, you should post the complete macro, so we can see which folders you are iterating over, and how.

  • Maybe a folder permissions problem that wasn’t there before Sierra? Have you tried with sudo mdfind?
  • You should quote the variable in the script like this "$KMVAR_rcPath"; otherwise it fails with pathnames with a space.

Thanks Tom, I will look into that. How do I post the macro?

See KM Wiki.