0

Running echo "say hello" | at now+1 on macOS should enqueue a task to be executed one minute in the future: saying hello. Issuing say hello works fine, as does echo "touch a-file" | at now+1, but the combination does not.

I believe that the runtime environment on which launchd executes atrun (the at daemon) is restricted and cannot complete the speech synthesis instructed by say. However, I cannot easily determine if this is the case.

What is the problem?

1
  • I'm also trying to get this to work. I figured out that echo say hello | at next minute responds Open speech channel failed: -915. But I'm not sure what to do about that.
    – ormuriauga
    May 9, 2021 at 18:01

1 Answer 1

0

Actually, I got it working, and I found a lengthy explanation of what is going on.

Apparently it's the same problem as this one: The macOS “say” utility does not work for non-root users in Sierra

Lengthy explanation: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard

After running brew install reattach-to-user-namespace I can now run echo reattach-to-user-namespace say hello | at next minute and it works!

To simplify my life I wrote a small wrapper and placed it in ~/bin which I added first in my $PATH. All it does is to call the original say with all the supplied arguments, but "reattached". As far as I can tell, reattaching when it isn't needed doesn't seem to do any harm.

~/bin/say:

#!/usr/bin/env bash
reattach-to-user-namespace /usr/bin/say $@

Now I can just write echo say -v Nora Rimember att de kettel is ånn de ståuv | at now +5 minutes and it works!

You must log in to answer this question.

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