xdotool
is a command line tool used to emulate mouse and keyboard.
The version on macport is too old so it doesn’t compile on Mac OS Sierra (last update was 2011).
xkbcommon
- Clone libxkbcommon. This is required to compile
xdotool
.#include <xkbcommon/xkbcommon.h>
- To use autogen.sh, it requires xorg-macros 1.16.
sudo port install xorg-util-macros
- When I first try to run
make
, this error comes up.YACC src/xkbcomp/parser.c /Users/fransiska/Git/libxkbcommon/src/xkbcomp/parser.y:220.5-9: syntax error, unexpected type, expecting string or identifier
The cause is that
bison
version is too old. Mac comes with the version 2.3. So we need to replace it.sudo port install bison cd /usr/bin/ sudo mv bison bison-2.3 sudo ln -s /opt/local/bin/bison bison
- Compile
libxkbcommon
../autogen.sh --enable-shared make
xdotool
- Clone xdotool.
- Fix
Makefile
to include the newly compiledlibxkbcommon
.DEFAULT_LIBS=-L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXtst -lXinerama -lxkbcommon -L/Users/fransiska/Git/libxkbcommon/.libs DEFAULT_INC=-I/usr/X11R6/include -I/usr/local/include -I/Users/fransiska/Git/libxkbcommon
I cloned the repository into
/Users/fransiska/Git/libxkbcommon
. - Compile it.
make sudo make install
- Link also the library for
libxkbcommon
(xdotool
asks it).cd /usr/local/lib/ sudo ln -s /Users/fransiska/Git/libxkbcommon/.libs/libxkbcommon*dylib . sudo ln -s /Users/fransiska/Git/libxkbcommon/.libs/libxkbcommon*a .
- Now that it launches, when you try to send commands, this error shows up.
Error: XTEST extension unavailable on '(null)'.
You need to enable it.
defaults write org.x.X11 enable_test_extensions -boolean true defaults write org.macosforge.xquartz.X11 enable_test_extensions -bool yes
- Restart XQuarts. Unfortunately, this only works on X terminals, so you can only test it on the xterm. One alternative to this for Mac OS is cliclick.