Fix `open` failure in mac tmux

一般在mac的命令行下,open可以用来打开某个文件或者程序,就像在GUI下双击一样,很方便。 但是最近发现如果用了tmux,open命令经常会报错:

The window server could not be contacted. open must be run with a user logged in at the console, either as that user or as root.

开始以为是环境变量有问题,用env将两个环境下的环境变量输出并diff之后,并没有发现可疑的地方,只好Google之。 最终在这里找到了答案

解决办法如下:

  • 升级你的reattach-to-user-namespace程序,这个是被tmux用来执行其他程序的。 brew update; brew upgrade reattach-to-user-namespace
  • 将以下内容添加到.tmux.conf配置文件中: set -g default-command "reattach-to-user-namespace -l /bin/bash"

看帖子里面的回复:

this bug in tmux that has been known for at least 6 years now

为啥还不修呢?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值