Visit The New, Modern Unix Linux Community

Tmux on AIX

Thread Tools Search this Thread
Operating Systems AIX Tmux on AIX
# 1  
Tmux on AIX

Hi, I'm going to build tmux from source on AIX 7.1. Reasons:
  • Terminal multiplexers are a must Smilie
  • tmux is to GNU screen (part of Toolbox) what vim is to the default AIX vi.
  • The later versions of tmux are considerably nicer than older versions.
  • Also, looks like IBM compiled screen without 256 colour support!

I'll post updates once I manage to build and run it successfully. If there is any interest I can provide detailed instructions, maybe even an installp package.

Last edited by topcat; 09-09-2019 at 03:04 AM..
# 2  
Yes, please post all your steps so others who might be interested can have the benefit of your knowledge.

# 3  
Thanks! I have successfully compiled tmux on my AIX 7.1 machine Smilie. Here's a run down of what needs to be done:

1. Download latest tmux source code from github:
git clone

git is available from the AIX Toolbox. The best way to install is to set up yum. I can help if you get into trouble here.

2. Download the dependency libevent:

3. Patch libevent code using the following diff (using patch command or by hand):
diff libevent/libevent-2.1.11-stable/include/event2/event-config.h.original libevent/libevent-2.1.11-stable/include/event2/event-config.h
< #define _LARGE_FILES 1
> //#define _LARGE_FILES 1

4. Compile libevent:
./configure CFLAGS="-g0" CXXFLAGS="-g0" --prefix=/home/users/software
make install

Note that my version of AIX has an issue with the as assembler which requires the CFLAGS="-g0" CXXFLAGS="-g0" flags. If your OS is fully up to date at the latest TL then it should not be necessary (please test first without the flags, and if it works I'd appreciate a post with the oslevel -s output).

6. Install (using yum) the following tmux dependencies: automake, pkg-config, bison (for yacc). Then add /usr/linux/bin to PATH. To test your path run
which yacc

5. Patch tmux code using the following diffs:
diff --git a/tmux.h b/tmux.h
index 41a09351..df5ba6cc 100644
--- a/tmux.h
+++ b/tmux.h
@@ -2666,4 +2666,9 @@ struct window_pane *spawn_pane(struct spawn_context *, char **);
 /* regsub.c */
 char           *regsub(const char *, const char *, const char *, int);

+/* define missing symbols */
+#define FNM_CASEFOLD  0x10  /* Case insensitive search. */
+#define REG_STARTEND (1 << 2)
+#define _PATH_DEFPATH "/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:/usr/linux/bin"
  #endif /* TMUX_H */

diff --git a/tty.c b/tty.c
index 1658fb74..2068c459 100644
--- a/tty.c
+++ b/tty.c
@@ -744,11 +744,11 @@ tty_window_offset1(struct tty *tty, u_int *ox, u_int *oy, u_int *sx, u_int *sy)
        struct client           *c = tty->client;
        struct window           *w = c->session->curw->window;
        struct window_pane      *wp = w->active;
-       u_int                    cx, cy, lines;
+       u_int                    cx, cy, newlines;

-       lines = status_line_size(c);
+       newlines = status_line_size(c);

-       if (tty->sx >= w->sx && tty->sy - lines >= w->sy) {
+       if (tty->sx >= w->sx && tty->sy - newlines >= w->sy) {
                *ox = 0;
                *oy = 0;
                *sx = w->sx;
@@ -759,7 +759,7 @@ tty_window_offset1(struct tty *tty, u_int *ox, u_int *oy, u_int *sx, u_int *sy)

        *sx = tty->sx;
-       *sy = tty->sy - lines;
+       *sy = tty->sy - newlines;

        if (c->pan_window == w) {
                if (*sx >= w->sx)
@@ -910,18 +910,18 @@ static int
 tty_is_visible(struct tty *tty, const struct tty_ctx *ctx, u_int px, u_int py,
     u_int nx, u_int ny)
-       u_int   xoff = ctx->xoff + px, yoff = ctx->yoff + py, lines;
+       u_int   xoff = ctx->xoff + px, yoff = ctx->yoff + py, newlines;

        if (!ctx->bigger)
                return (1);

        if (status_at_line(tty->client) == 0)
-               lines = status_line_size(tty->client);
+               newlines = status_line_size(tty->client);
-               lines = 0;
+               newlines = 0;

        if (xoff + nx <= ctx->ox || xoff >= ctx->ox + ctx->sx ||
-           yoff + ny <= ctx->oy || yoff >= lines + ctx->oy + ctx->sy)
+           yoff + ny <= ctx->oy || yoff >= newlines + ctx->oy + ctx->sy)
                return (0);
        return (1);

In the above we are simple renaming the variable lines to newlines to avoid a conflict.

6. Build tmux:
./configure CFLAGS="-g0" CXXFLAGS="-g0" --prefix=/home/users/software LDFLAGS=-L/home/users/software/lib CPPFLAGS=-I/home/users/software/include/
make install

Once again, please test first without the CFLAGS="-g0" CXXFLAGS="-g0" flags.

7. tmux requires the UTF-8 locale. You can install it from the AIX install DVD 1 using:
installp -acgYd /cdmnt bos.loc.utf.EN_US

Assuming you have mounted the DVD on /cdmnt. Next set the locale in your shell:
export LANG=EN_US.UTF-8
export LC_ALL=EN_US.UTF-8

Check using the locale command.

The install is now complete. Please read the next post for information about how to use 256 colours.
These 2 Users Gave Thanks to topcat For This Post:
# 4  
Ok, tmux is now installed and running! Let's make it beautiful Smilie

1. Set terminal to 256 colour mode by setting TERM in your shell:
export TERM=xterm-256color

2. The IBM supplied terminfo settings for xterm-256color (use infocmp xterm-256color to view it) are missing the the entries for the setab and setaf features, which tell the terminal how to set background and foreground colours, respectively. Run man terminfo and search for setb, setf. Running tmux info inside a tmux session will show the missing entries. This is fixed by the following code in .tmux.conf:
# Supply missing terminal features: set foreground/background colours.
 set-option -s terminal-overrides[0] "xterm-256*:setab=\e[4%p1%dm:setaf=\e[3%p1%dm"

Now you should have 256 colours. I am attaching my .tmux.conf as an example.

# Supply missing terminal features: set foreground/background colours.
set-option -s terminal-overrides[0] "xterm-256*:setab=\e[4%p1%dm:setaf=\e[3%p1%dm"

# Enable mouse
set-option -g mouse on

# Remap window navigation to vim
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R

unbind-key C-v
bind-key C-v last-window

# Access clipboard
# move x clipboard into tmux paste buffer
unbind-key C-p
bind-key C-p run "tmux set-buffer \"$(xclip -o -selection clipboard)\"; tmux paste-buffer"
# move tmux copy buffer into x clipboard
unbind-key C-y
bind-key C-y run "tmux save-buffer - | xclip -i -selection clipboard > /dev/null"

# Set 256 colour terminal
#set -g default-terminal "screen-256color"

# Status bar colour
set -g status-bg colour28
set -g status-fg colour255

# Activity
setw -g monitor-activity on
set -g visual-activity off
# Highlight active window
setw -g window-status-current-style bg=colour19

# Additional mouse setup
bind-key -n MouseDown3Status new-window -a -t=
bind-key -n MouseDrag1Status swap-window -t=

# Intelligent scrolling
bind -n WheelUpPane if-shell -Ft= '#{?pane_in_mode,1,#{mouse_any_flag}}' \
        'send -Mt=' 'if-shell -Ft= "#{alternate_on}" \
        "send -t= Up" "copy-mode -et=\; send -Mt="'
bind -n WheelDownPane if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
        'send -Mt=' 'if-shell -Ft= "#{alternate_on}" \
        "send -t= Down" "send -Mt="'

# For emacs
setw -g xterm-keys on

# History for Ctrl-B :
set -g history-file ~/.tmux_history

These 3 Users Gave Thanks to topcat For This Post:
# 5  
FYI, I talked with the tmux developer, Nicholas, and intend to support tmux development on AIX since he does not have access to an AIX box. Right now there is no official support for AIX and I hope to improve on that Smilie

I'm currently working on fixing a couple of small issues.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #402
Difficulty: Medium
The term 3D printing originally referred to a powder bed process employing standard and custom inkjet print heads.
True or False?

4 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Installing tmux on RHEL 6.5

Hi, I am trying to install tmux on vm allocated to me in my company . i am very new to linux. I have the root access on it. Can someone please provide the exact steps to get it installed. I tried: 1. Using yum, i get the below message. # yum install tmux Loaded plugins: security... (6 Replies)
Discussion started by: kunwar
6 Replies

2. UNIX for Beginners Questions & Answers

Tmux - pane current command - help !

Hello Experts ! i have started using tmux recent past . So far so good . while exploring the option , i found an option as I log into terminal where i enabled the tmux , and then i log onto a taxi server and then to my application server. My expectation is when i going aound the paths on... (1 Reply)
Discussion started by: radha254
1 Replies

3. AIX

Will it affect my AIX LPAR security, when i set up email alerts on AIX server.

Hello, I've set up email alerts on AIX Servers. so that i can get email notifications (via mail relay server) when ever there is abnormal behavior. for example 1) my script monitors CPU/disk/memory etc... when it reaches high water ark, it will send an email alert. 2) disk usage alerts 3)... (5 Replies)
Discussion started by: System Admin 77
5 Replies

4. AIX

Nim on AIX 7.1 used to migrate AIX 5.3 to AIX possible?

Using nimadm: nimadm -j nimadmvg -c sap024 -s spot_6100 -l lpp_6100 -d "hdisk1" -Y Initializing the NIM master. Initializing NIM client sap024. 0505-205 nimadm: The level of bos.alt_disk_install.rte installed in SPOT spot_6100 ( does not match the NIM master's level ( (2 Replies)
Discussion started by: sciacca75
2 Replies

Featured Tech Videos