Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hang When Running from Tmux on OS X 10.10 Yosemite #115

Closed
smackesey opened this issue Oct 27, 2014 · 28 comments
Closed

Hang When Running from Tmux on OS X 10.10 Yosemite #115

smackesey opened this issue Oct 27, 2014 · 28 comments

Comments

@smackesey
Copy link

When I run terminal-notifier from tmux on OS X 10.10 Yosemite, it hangs:

terminal-notifier -message "his name was robert paulson"
# ... hanging

It works fine when running it from outside tmux. This may have something to do with reattach-to-user-namespace. My tmux is configured with this line:

set-option -g default-command "reattach-to-user-namespace -l zsh"

Which was taken from the instructions from this page.

@julienXX
Copy link
Owner

As I said in #106 unfortunately I'm not a tmux user so if someone finds a solution please post it here. My guess is that the issue may lie in reattach-to-user-namespace and yosemite.

@cpf
Copy link

cpf commented Oct 27, 2014

In my case, tmux is started through byobu. I'm unsure on what the starting parameters are though. I don't have reattach-to-user-namespace installed, so it shouldn't be that.

@firedev
Copy link

firedev commented Oct 28, 2014

Just my two cents, I run Yosemite, tmux, have reattach-to-user-namespace command and it doesn't hang. Did you run bundle update recently?

@daviesgeek
Copy link

I'm having the same problem with Yosemite (10.10.0) and tmux (1.9a)
I can confirm that it does work outside of tmux.

@dreynolds
Copy link

I have the same problem, /Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -message eggs fails under tmux and works fine in a non-tmux terminal

@daviesgeek
Copy link

My install is from Homebrew if that makes any difference.

@patrickkettner
Copy link

weirdly enough - it is now working for me inside of tmux. Perhaps it was the update to 1.9a?

@smackesey
Copy link
Author

It's working for me now too. I updated two things, but I'm not sure which one did the trick:

  • tmux is now 1.9a
  • reattach-to-user-namespace is 2.3

These are both the most recent versions from homebrew. I realized I had an old reattach-to-user-namespace in a scripts dir at the front of $PATH, probably from some old set of instructions from back before there was a reattach-to-user-namespace homebrew formula. So even though my installation was being updated via homebrew, it was always the old one being used. Anyway anyone still having these issues should make sure they have these most recent versions of both tmux and reattach-to-user-namespace.

@bessarabov
Copy link

Anyway anyone still having these issues should make sure they have these most recent versions of both tmux and reattach-to-user-namespace.

Does not work for me. I already had the latest versions:

bessarabov@air:~$ reattach-to-user-namespace --version
reattach-to-user-namespace version 2.3
    Supported OSes: OS X 10.5-10.10
bessarabov@air:~$ tmux -V
tmux 1.9a

I've reinstalled them with brew update; brew reinstall reattach-to-user-namespace; brew reinstall tmux, but it does not help either.

@patrickkettner
Copy link

@bessarabov - what version of terminal-notifier are you running? where did you install it from?

@bessarabov
Copy link

@patrickkettner I'm using: 1.6.1 installed via brew:

bessarabov@air:~$ terminal-notifier -version | head -1
terminal-notifier (1.6.1) is a command-line tool to send OS X User Notifications.

I see that in this repo is tag 1.6.2, but brew does not know about it:

bessarabov@air:~$ brew update
...
bessarabov@air:~$ brew install terminal-notifier
Error: terminal-notifier-1.6.1 already installed
To install this version, first `brew unlink terminal-notifier'

@julienXX
Copy link
Owner

julienXX commented Nov 4, 2014

@bessarabov try a brew upgrade after brew update.

@bessarabov
Copy link

@bessarabov Thank you, brew upgrade installed terminal-notifier version 1.6.2 (and to be sure I've even restarterd my macbook).

But I still has the problem outside tmux terminal-notifier -message 'asdf' works perfectly well, but in tmux it hangs.

Here are the versions I have:

bessarabov@air:~$ reattach-to-user-namespace --version
reattach-to-user-namespace version 2.3
    Supported OSes: OS X 10.5-10.10
bessarabov@air:~$ tmux -V
tmux 1.9a
bessarabov@air:~$ terminal-notifier | head -1
terminal-notifier (1.6.2) is a command-line tool to send OS X User Notifications.
bessarabov@air:~$

I'm using iTerm, but I checked this behavior in Mac OS default Terminal App. I got the same behaviour in iTerm and in Terminal.app.

@carldavis
Copy link

I am using tmux and terminal-notifier does and doesn't work for me and I hoped someone could help me understand and fix it. If I execute the following command it works fine.

terminal-notifier -message test

However, when I execute the same command via a tmux new-window shell-command it fails and hangs.

tmux new-window -d -t Background:9999 -n test 'terminal-notifier -message test'

@adamyonk
Copy link

I can confirm that tmux 1.9a (homebrew), reattach-to-user-namespace 2.3 (homebrew), and terminal-notifier 1.6.2 (gem) work on Yosemite 10.10.1.

 ✖ adamyonk
 ➔ tmux -V
tmux 1.9a
 ✖ adamyonk
 ➔ reattach-to-user-namespace --version
reattach-to-user-namespace version 2.3
    Supported OSes: OS X 10.5-10.10
 ✖ adamyonk
 ➔ gem list terminal-notifier

*** LOCAL GEMS ***

terminal-notifier (1.6.2)
terminal-notifier-guard (1.6.4)

I had to remove an older version of reattach-to-user-namespace that I had in my $PATH, so I also had to completely kill/restart the tmux server, then everything worked.

@buccolo
Copy link

buccolo commented Jan 28, 2015

Hi @adamyonk,

Do you have any other configuration set?

I have the same exact setup as you, but my terminal-notifier still hangs inside tmux.

~/ $ tmux -V
tmux 1.9a
~/ $ reattach-to-user-namespace --version
reattach-to-user-namespace version 2.3
    Supported OSes: OS X 10.5-10.10
~/ $ gem list terminal-notifier

*** LOCAL GEMS ***

terminal-notifier (1.6.2)

Also on Yosemite 10.10.1.

@adamyonk
Copy link

Make sure you've killed/restarted tmux so you don't have an old session around. Beyond that, it looks like our setups are the same. I have this as my default-command:

set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"

@buccolo
Copy link

buccolo commented Jan 28, 2015

Of course @adamyonk!

I had disabled reattach-to-user-namespace. After enabling it back on I can see the notifications just fine.

Thanks 🍻

@adamyonk
Copy link

@buccolo, oh good! So glad it worked!

@unphased
Copy link

Can someone explain why reattach-to-user-namespace is required for terminal-notifier when inside tmux?

@ptbrowne
Copy link

I use fish shell and tmux. I put set-option -g default-command "reattach-to-user-namespace -l fish in my .tmux.conf and it works now 👍 Thanks @adamyonk

@oschrenk
Copy link

Thanks @adamyonk

@waynew
Copy link

waynew commented May 23, 2015

That's odd - I have zero problems with pbcopy from within tmux, but the terminal notifier doesn't work

@unphased
Copy link

@waynew Yeah, in a recent OS X release, pbcopy/pbpaste etc started to work fine without reattach-to-user-namespace. But I guess whatever Apple/iTerm2 changed doesn't help for this...

These days I don't run gulp on my mac anymore (CPU consumption due to file polling? seriously?), but when I do I just run it outside tmux. easy.

@konstan
Copy link

konstan commented May 27, 2015

FYI. Followed the steps listed by @rbf in #115 (comment) and now my side terminal-notifier no longer hangs when launched from tmux.

@e9t
Copy link

e9t commented Jun 27, 2015

Another similar work-around is to add the line below to .bashrc:

alias terminal-notifier='reattach-to-user-namespace terminal-notifier'

For the record, I've had similar issues before with Sublime Text. Hope that helps in fixing the issue.

slashmili added a commit to slashmili/ex_guard that referenced this issue Apr 6, 2016
ikr added a commit to ikr/dotfiles that referenced this issue Sep 9, 2016
Fixes the notifications in Profanity.im under tmux. Source:

julienXX/terminal-notifier#115 (comment)
@julienXX julienXX mentioned this issue Feb 16, 2017
srl295 added a commit to srl295/.profile.d that referenced this issue Feb 21, 2017
otherwise shell commands hang inside tmux/byobu/etc

work around julienXX/terminal-notifier#115
@julienXX
Copy link
Owner

Closing the issue, feel free to re-open if there is something I can help with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests