On OS X, HTK has its own dependencies which you'll need to install. The process, in four parts are:
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.
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:
- Go to the Mac Dev Center, register (for free) and log in.
- Go to Downloads, and and then View All Downloads.
- Search for "command line tools."
- Download and install the version appropriate for your operating system.
A graphical representation:
1. Register and login
2. Downloads
2. View All Downloads
3 & 4. Search for "command line tools" and download
X11
Go to http://xquartz.macosforge.org/, download XQuartz from there and install it using the installer.
Downloading and Fixing HTK
Download HTK
You'll need to register (free) with HTK to download it. Visit http://htk.eng.cam.ac.uk/register.shtmlto 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.
After downloading HTK, unpack the .tar.gz
file, which will unpack into a directory called "htk".
Fixing HTK Source
In the htk directory, navigate to htk>HTKLib, and open the file HRec.c in a plain text editor.
Find the line 1650 which reads
if (dur<=0 && labid != splabid) HError(8522,"LatFromPaths: Align have dur<=0 ");
Note, this is the second instance of this if statement. You can tell that you're changing the right line because this one has a space between 0
and the final quote, while the wrong line has two spaces between Align
and have
. labid
in this line should be changed to labpr
. It should look like this:
if (dur<=0 && labpr != splabid) HError(8522,"LatFromPaths: Align have dur<=0 ");
Installing HTK
Nearly there! Now, open the Terminal application, and navigate to the htk, folder, which is probably in your Downloads.
cd ~/Downloads/htk
Now run the following lines of code
export CPPFLAGS=-I/opt/X11/include
./configure
make all
sudo make install
You'll be asked to enter your administrative password after that last line of code.