![macOS 的“say”实用程序不适用于 Sierra 中的非 root 用户](https://linux22.com/image/1510636/macOS%20%E7%9A%84%E2%80%9Csay%E2%80%9D%E5%AE%9E%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%B8%8D%E9%80%82%E7%94%A8%E4%BA%8E%20Sierra%20%E4%B8%AD%E7%9A%84%E9%9D%9E%20root%20%E7%94%A8%E6%88%B7.png)
我有一个程序可以调用say
我 Mac 上的命令行实用程序,但在我升级到 macOS Sierra 后该程序就停止工作了。
当我尝试/usr/bin/say
从命令行运行该命令时,它只是挂起(需要ctrl+ c)。
如果我以 root 身份运行,它就可以正常工作。我不明白 Sierra 中发生了哪些变化,导致了这种奇怪的行为。
答案1
这是与 tmux 的兼容性问题。在 tmux 会话之外可按预期工作。
答案2
确保reattach-to-user-namespace
程序已安装,并在 tmux 会话内运行“say”实用程序时将如下行添加到您的 ~/.tmux.conf。
brew install reattach-to-user-namespace
# In .tmux.conf:
set-option -g default-command "reattach-to-user-namespace -l zsh"
# To kill your existing tmux server (and everything running “inside” it!):
tmux kill-server
一些有用的链接:
1. Mac“say”在 tmux 会话中不起作用 -https://github.com/tmux/tmux/issues/716
2. tmux-MacOSX-粘贴板 -https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard