VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app

How to Copy and Paste to/from the Global Register with Tmux on Mac OS X

       

Using the system clipboard with tmux on OS X is broken. I really like tmux but having copy and paste is kind of important for me. Here is my attempt to get it back with a simple bash script until I find something better. The approach is to take a named pipe and feed it the contents of "tmux showb". A bash script will manage the pipe and because this script is initialized from a normal session it will write to the system clipboard just fine.

In my .bash_profile...

pipe4tmux=/tmp/pipe4tmux
alias tcp="tmux showb > $pipe4tmux"
if [[ ! -p $pipe4tmux ]]; then
~/pipe4tmux.sh &
fi

And in pipe4tmux.sh...

#!/bin/bash
pipe4tmux=/tmp/pipe4tmux
echo "Starting named pipe $pipe4tmux"
trap "rm -f $pipe4tmux" EXIT

if [[ ! -p $pipe4tmux ]]; then
    mkfifo $pipe4tmux
fi

while true
do
    pbcopy < $pipe4tmux
done

echo "Quitting pipe4tmux $pip4tmux"
Tagged w/ #bash #configuration #development environment #named pipe #pipes #tmuxbash #environment #linux