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

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

Comments

Projects
None yet
@smackesey

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

This comment has been minimized.

Show comment
Hide comment
@julienXX

julienXX Oct 27, 2014

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.

Owner

julienXX commented Oct 27, 2014

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

This comment has been minimized.

Show comment
Hide comment
@cpf

cpf 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.

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

This comment has been minimized.

Show comment
Hide comment
@firedev

firedev 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?

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

This comment has been minimized.

Show comment
Hide comment
@daviesgeek

daviesgeek Oct 29, 2014

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.

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

This comment has been minimized.

Show comment
Hide comment
@dreynolds

dreynolds Oct 31, 2014

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

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

This comment has been minimized.

Show comment
Hide comment
@daviesgeek

daviesgeek Oct 31, 2014

My install is from Homebrew if that makes any difference.

My install is from Homebrew if that makes any difference.

@patrickkettner

This comment has been minimized.

Show comment
Hide comment
@patrickkettner

patrickkettner Oct 31, 2014

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

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

@smackesey

This comment has been minimized.

Show comment
Hide comment
@smackesey

smackesey Nov 1, 2014

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.

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

This comment has been minimized.

Show comment
Hide comment
@bessarabov

bessarabov Nov 2, 2014

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.

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

This comment has been minimized.

Show comment
Hide comment
@patrickkettner

patrickkettner Nov 2, 2014

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

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

@bessarabov

This comment has been minimized.

Show comment
Hide comment
@bessarabov

bessarabov Nov 4, 2014

@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'

@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

This comment has been minimized.

Show comment
Hide comment
@julienXX

julienXX Nov 4, 2014

Owner

@bessarabov try a brew upgrade after brew update.

Owner

julienXX commented Nov 4, 2014

@bessarabov try a brew upgrade after brew update.

@bessarabov

This comment has been minimized.

Show comment
Hide comment
@bessarabov

bessarabov Nov 4, 2014

@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.

@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

This comment has been minimized.

Show comment
Hide comment
@carldavis

carldavis Nov 7, 2014

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'

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

This comment has been minimized.

Show comment
Hide comment
@adamyonk

adamyonk Nov 12, 2014

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.

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.

@julienXX julienXX added the 10.10 label Dec 27, 2014

@buccolo

This comment has been minimized.

Show comment
Hide comment
@buccolo

buccolo 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.

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

This comment has been minimized.

Show comment
Hide comment
@adamyonk

adamyonk Jan 28, 2015

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"

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

This comment has been minimized.

Show comment
Hide comment
@buccolo

buccolo 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 🍻

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

This comment has been minimized.

Show comment
Hide comment
@adamyonk

adamyonk Jan 28, 2015

@buccolo, oh good! So glad it worked!

@buccolo, oh good! So glad it worked!

@unphased unphased referenced this issue in mikaelbr/gulp-notify Feb 21, 2015

Closed

How to debug for OSX #70

@unphased

This comment has been minimized.

Show comment
Hide comment
@unphased

unphased Feb 21, 2015

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

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

@ptbrowne

This comment has been minimized.

Show comment
Hide comment
@ptbrowne

ptbrowne Feb 28, 2015

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

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

@frdmn frdmn referenced this issue in dylang/grunt-notify Mar 9, 2015

Open

tmux support #92

@girvo girvo referenced this issue in mikaelbr/gulp-notify Mar 12, 2015

Open

Doesn't work under Tmux #73

@oschrenk

This comment has been minimized.

Show comment
Hide comment

Thanks @adamyonk

@rbf

This comment has been minimized.

Show comment
Hide comment
@rbf

rbf May 21, 2015

I had the same issue as described here, i.e. terminal-notifier worked only outside tmux since Mac OS X Yosemite. After reading this thread, I can confirm following steps solved the issue for me:

  1. upgrade tmux form 1.9a to 2.0 with brew update && brew upgrade tmux

  2. install reattach-to-user-namespace with brew update && brew install reattach-to-user-namespace

  3. add following lines to at the beginning of my ~/.tmux.conf file (inspired from the commit referenced above):

    # Reattach each new window to the user bootstrap namespace
    # https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
    set -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL -l"

Step 1. alone didn't fix the issue, but adding reattach-to-user-namespace did the trick. As a bonus I can finally use pbcopy and pbpaste inside tmux. 🎉

My current working environment after the upgrades is the following:

sw_vers -productVersion  # Mac OS Version
# 10.10.3
terminal-notifier -v | head -1
# terminal-notifier (1.6.3) is a command-line tool to send OS X User Notifications.
tmux -V
# tmux 2.0
reattach-to-user-namespace -v
# reattach-to-user-namespace version 2.3
#     Supported OSes: OS X 10.5-10.10

rbf commented May 21, 2015

I had the same issue as described here, i.e. terminal-notifier worked only outside tmux since Mac OS X Yosemite. After reading this thread, I can confirm following steps solved the issue for me:

  1. upgrade tmux form 1.9a to 2.0 with brew update && brew upgrade tmux

  2. install reattach-to-user-namespace with brew update && brew install reattach-to-user-namespace

  3. add following lines to at the beginning of my ~/.tmux.conf file (inspired from the commit referenced above):

    # Reattach each new window to the user bootstrap namespace
    # https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
    set -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL -l"

Step 1. alone didn't fix the issue, but adding reattach-to-user-namespace did the trick. As a bonus I can finally use pbcopy and pbpaste inside tmux. 🎉

My current working environment after the upgrades is the following:

sw_vers -productVersion  # Mac OS Version
# 10.10.3
terminal-notifier -v | head -1
# terminal-notifier (1.6.3) is a command-line tool to send OS X User Notifications.
tmux -V
# tmux 2.0
reattach-to-user-namespace -v
# reattach-to-user-namespace version 2.3
#     Supported OSes: OS X 10.5-10.10
@waynew

This comment has been minimized.

Show comment
Hide comment
@waynew

waynew May 23, 2015

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

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

This comment has been minimized.

Show comment
Hide comment
@unphased

unphased May 23, 2015

@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.

@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

This comment has been minimized.

Show comment
Hide comment
@konstan

konstan 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.

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.

@unphased unphased referenced this issue in kiibohd/controller May 31, 2015

Closed

Can't get serial to work #42

@e9t

This comment has been minimized.

Show comment
Hide comment
@e9t

e9t 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.

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.

@timoxley timoxley referenced this issue in mikaelbr/node-notifier Jul 5, 2015

Closed

hangs within tmux session #61

@blacksails blacksails referenced this issue in paddykontschak/irssi-notifier Aug 15, 2015

Closed

Irssi crash under tmux #12

@skoppe skoppe referenced this issue in mikaelbr/node-notifier Apr 1, 2016

Closed

Hangs in tmux on osx #110

slashmili added a commit to slashmili/ex_guard that referenced this issue Apr 6, 2016

ikr added a commit to ikr/home-dir that referenced this issue Sep 9, 2016

Fix terminal-notifier
Fixes the notifications in Profanity.im under tmux. Source:

julienXX/terminal-notifier#115 (comment)

@julienXX julienXX referenced this issue Feb 16, 2017

Closed

Not work #199

srl295 added a commit to srl295/.profile.d that referenced this issue Feb 21, 2017

need to use reattach-to-user-namespace
otherwise shell commands hang inside tmux/byobu/etc

work around julienXX/terminal-notifier#115
@julienXX

This comment has been minimized.

Show comment
Hide comment
@julienXX

julienXX May 13, 2017

Owner

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

Owner

julienXX commented May 13, 2017

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

@julienXX julienXX closed this May 13, 2017

@evq evq referenced this issue in brave/browser-laptop May 17, 2017

Closed

build hangs in tmux on macOS #8916

@vlovich vlovich referenced this issue Jun 6, 2017

Closed

File URL fails to open #227

2 of 3 tasks complete

@GoldbergData GoldbergData referenced this issue Apr 5, 2018

Closed

Does not work on my system #247

1 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment