18

Trying to open an application from the commandline (Terminal.app), inside tmux (installed through MacPorts, version 1.9a), and getting the following result:

$ open /Applications/Adobe\ Reader.app/
LSOpenURLsWithRole() failed with error -10810 for the file /Applications/Adobe Reader.app.

The same command works fine, from the same terminal, if executed outside tmux.

Enviroment should be read from host; the following is in tmux.conf : set -g update-environment -r

When restarting terminal.app or tmux, it sometimes errors out with a different message at first, (see below) and when tried again, the above error -10810 is given instead.

$ open /Applications/Adobe\ Reader.app/
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.

I've tried both Apples own apps (Preview, Font Book, Contacts) and third party (Adobe, Evernote etc). No difference. The one app that does seem to work, is finder. (open [dirname], for instance.)

2 Answers 2

20

There is a solution/workaround for this:

  • Update your version of reattach-to-user-namespace. This is used by tmux to execute programs. I use brew rather than macports, so I just did: brew update; brew upgrade reattach-to-user-namespace. Macports is likely to be able to do something similar.
  • Add the following to your .tmux.conf file:

    set -g default-command "reattach-to-user-namespace -l /bin/bash"

Restart your tmux session and that should allow you to start programs from the command line.

Further information can be found at this github issue.

2
  • FWIW, updating reattach-to-user-namespace makes no difference for me, and the problem still persists. It seems tmux must be fixed itself (see other answer). Aug 3, 2015 at 15:32
  • 1
    when not using the default shell, make sure to change the path in the command (e.g., path/to/your/fish). Jan 24, 2016 at 9:34
3

The issue is that tmux is changing the bootstrap to system domain when it shouldn't (see https://trac.macports.org/ticket/18357). Older versions of launchd worked around this bug in tmux, but the rewritten launchd in OS X Yosemite does not work around this tmux bug.

You will either need to wait for Apple to possibly release an update that works around the tmux bug or pester tmux developers to fix this bug in tmux that has been known for at least 6 years now.

You must log in to answer this question.

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