Compiling GNU Typist (gtypist) on MacOS
A while back, I decided it was time to finally learn how to touch-type. I was never a slow typer, but my hands constantly roamed the keyboard instead of staying in the home position. Inspired by Steve Yegge to do better, I settled on using GNU Typist (the command is gtypist) as my practice partner.
GNU Typist is run from a terminal window, and is fast enough to run under an ssh session. I’ve run it remotely on RHEL and locally on Linux Mint and WSL. I did have some issues when I tried to build it from my Macbook. I forked the project and made some minor changes to the build process. Here is how I got it to build on MacOS:
Main Prerequisites: xcode, homebrew, and bash
The first step to compiling gtypist on MacOS is to make sure you have all the tools you’ll need: the Xcode command line tools, homebrew, and a modern version of bash.
You can find my guide for installing these tools here.
Install Dependencies
I use homebrew to install all the dependencies needed to build gtypist.
$ brew install ncurses
$ brew install automake
$ brew install gawk
$ brew install texinfo
$ brew install gengetopt
$ brew install xz
$ brew install help2man
A couple of notes:
-
Make sure you have the most up-to-date versions of all the tools. In particular, I found that using an outdated version of
automake
(that does not match the C compiler version) will cause the build to fail. -
As an alternative, I installed the
help2man
directly from the GNU source. That utility is actually a Perl script, and I already have a modern version ofperl
installed on my system. If that doesn’t apply to you, the Homebrew installation will work fine.
Download and compile gtypist
I have forked the main GNU repository version and made a few minor edits to get the macos build working.
$ git clone -b macbuild https://github.com/kcaran/gtypist.git
$ cd gtypist
$ ./autogen.sh CFLAGS="-I$(brew --prefix)/opt/ncurses/include/" LDFLAGS="-L$(brew --prefix)/opt/ncurses/lib/"
Test and Install
You can test-run gtypist directly from the build directory before installing it for global use.
$ src/gtypist lessons/gtypist.typ
$ sudo make install
And that’s it! You now have a working version of GNU Typist installed on your Mac. To start a lesson, just run gtypist from your terminal. Happy typing!