Unable to use 'open' command in OSX tmux

I recently installed tmux on my laptop running OSX 10.10.4. I’d not had any issues until I tried to use the ‘open’ command in order to install a .pkg file manually.

When I ran open package.pkg, I got the following output;

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 found the fix on a chinese blog

brew update
brew install reattach-to-user-namespace
brew upgrade reattach-to-user-namespace
echo "set -g default-command \"reattach-to-user-namespace -l ${SHELL}\"" >> ~/.tmux.conf

If you’re in tmux, exit and start a new session.

You can now use the open command without any issues inside tmux.

comments powered by Disqus