Skip to content
Robert Fromont edited this page Aug 24, 2023 · 18 revisions

On OS X, HTK has its own dependencies which you'll need to install. The process, in four parts are:

  1. Command Line Tools
  2. X11
  3. Downloading and fixing HTK
  4. Installing HTK

Command line Tools

It is necessary to install a C compiler to install HTK. If you are not sure whether you have a C compiler installed, open the Terminal application and type

gcc -v

If you see -bash: gcc: command not found, then you need to install the C compiler.

macOS Catalina (10.15)

As of September 2020, the ability to install xcode from the command line is broken (see discussion at Homebrew project). The best workaround is to manually download and install "Command Line Tools for Xcode 12" from Apple's website at https://developer.apple.com/download/more/ similar to the instructions for OS X 10.8 below.

OS X Mavericks (10.9)

In OS X Mavericks (10.9), installation of command line tools has been greatly simplified. If you are running Mavericks, just open the Terminal application and type

xcode-select --install

Just select "Install" in the window which pops open.

OS X Lion and Mountain Lion (10.7 & 10.8)

You need to install command line tools and X11. The here are the steps involved:

  1. Go to the Mac Dev Center, register (for free) and log in.
  2. Go to Downloads, and and then View All Downloads.
  3. Search for "command line tools."
  4. Download and install the version appropriate for your operating system.

A graphical representation:

1. Register and login

login

2. Downloads

download1

2. View All Downloads

download2

3 & 4. Search for "command line tools" and download

download3

Downloading HTK

Download HTK

You'll need to register (free) with HTK to download it. Visit http://htk.eng.cam.ac.uk/register.shtml to register, and they will e-mail you a password.

After that, visit http://htk.eng.cam.ac.uk/download.shtml, and download the HTK source code under Linux/Unix downloads.

htk download

After downloading HTK, unpack the .tar.gz file, which will unpack into a directory called "htk".

Now, open the Terminal application, and navigate to the htk, folder, which is probably in your Downloads.

cd ~/Downloads/htk

If you've got a new M1 or M2 machine (with an ARM processor rather than an Intel processor), you need to do two extra steps:

  1. Run the following command:
sed -i -e 's|^#include <malloc.h>$|/*#include <malloc.h>*/|g' HTKLib/strarr.c
  1. Edit the file called configure and insert the following lines at line 5561 (i.e. just before the line that says esac):
        arm*darwin*)
                CFLAGS="-Wno-implicit-function-declaration -D'ARCH=\"darwin\"' $CFLAGS"
                ARCH=darwin
                Objcopy=echo
                PRILF="-x"
                CPU=darwin
                SHRLF="-shared"
                LIBEXT=dylib
        ;;

Save your changes to the configure file.

Now (regardless of whether you're using an ARM or Intel system) run the following lines of code

export CPPFLAGS=-UPHNALG
./configure --without-x --disable-hslab
make all
sudo make install

You'll be asked to enter your administrative password after that last line of code.