LoginSignup
2
1

More than 5 years have passed since last update.

Homebrewでtmuxをインストール&初期設定

Posted at

余り使いこなせてるとは思えないのだけど、自宅のMacでtmuxを使っているので、ひとまず最小限の設定をする方法を。

参考:tmux 1.9aの挙動が怪しかったので1.8に戻した

一時期、上記を参考に1.8で運用していたのだけれど、Homebrewの最新化をした際に1.9aに更新して、現時点では余り不具合を感じていません。

ということで、当座はこのまま1.9aで運用する予定です。

Homebrewでtmuxをインストール

install
$ brew install tmux
$ brew install reattach-to-user-namespace

tmux本体と合わせてreattach-to-user-namespaceを入れます。

参考:Mac の tmux でクリップボードを使う。

現状試してみた範囲では、pbcopy/pbpastereattach-to-user-namespaceありならOKなのですが、launchctlが余りまともに動かず(^_^;)

reattach-to-user-namespace関連テスト
$ echo hoge | pbcopy
$ pbpaste
hoge
$ launchctl load ~/Library/LaunchAgents/org.ksworks.PeriodicWork.plist 
nothing found to load

ひとまずはlaunchctlを使わない運用方針に切り替えることで対処としますorz

最低限のtmux.conf

使うにあたって、プレフィクスコマンドC-bが予約されてしまうと、1文字前に移動(backward-char)を良く利用するのでツラい(^_^;)

ということで、プレフィクスコマンドはC-zに変更します。

合わせて、先ほどインストールしておいたreattach-to-user-namespaceの設定と、何か変更した時に設定ファイルをリロードするためのキーバインド設定(C-z C-r)を作っておきます。

~/.tmux.conf
# Prefix: C-z
unbind C-b
set -g prefix C-z
bind C-z send-prefix

# for pbcopy/pbpaste/launchctl
set-option -g default-command "reattach-to-user-namespace -l bash"

# reload
bind C-r source-file ~/.tmux.conf \; display "reload: ~/.tmux.conf"

この辺りまでが自分なりの最低限の設定ということで…

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1