Installation of Therion including Loch on MacOS X

  • This guide is for system 10.5 (checked for 10.6.5 too). Older systems may require more pieces of the puzzle to install.
  • The installation is not complicated, but it is not the “double-click on image and drag and drop” kind of installation.
  • You should have administrator rights to install all of the parts.
  • Try to play a bit with Terminal program before you start. You'll need to use it to change several parameters of the installation packages and at the end to start Xtherion editor itself.
  • It is recommended to run the system disk “Repair Disk Permissions” from Disk Utility program after each step.
  • If you are *X guru, you may do all the steps your way, of course.

1. MacOSX

First of all install Mac OS X system and all updates. There could be problem with MacOS X 10.6.n - xtherion doesn't recognize thconfig files to open it directly from Xtherion. So you should start Xtherion together with particular thconfig:

xtherion your_thconfig_file

The trick you may use it to use “thconfig” as file extension - file.thconfig and Xtherion will recognize you configuration file.

2. X-Code

Install X-Code (developer tools) from installation DVD of Mac OS X. You have to update it to the latest version of XCode - version 3.2.1 (20091102).

3. Tcl/Tk

The Tcl/Tk distribution is part of X-Code installation, but the latest version you'll find here: → click Tcl tab → download Active Tcl
And you can find help on site of some cv writer Installation is straightforward – just mount the image by double-click and run install program.

To use your newly installed latest version of Tcl you must modify the link where programs are looking for Tcl. Open the application Terminal and write on the command line:

sudo rm /usr/bin/wish 

press [Enter] and write your administrator password when prompted, press [Enter].
Update instalation of ActiveTCL:

sudo teacup update

press [Enter] and write your administrator password if prompted (perhaps not), press [Enter]. \\After update create softlink to application wish:

sudo ln -s /usr/local/bin/wish8.5 /opt/local/bin/wish

(the number must be the actual version of Active Tcl you installed)
press [Enter] and write your administrator password if prompted (perhaps not), press [Enter].

The others programs should find your latest version of Tcl now.

You may verify it by typing on command line:

wish [Enter]

The application Wish should start. Switch to Wish application and check the version at About Tcl & Tk… under application menu. You may stop the Wish as usual - [Command]+Q.
There could be a problem the wish application stopped with message it is not able to find something. In that case you should find and delete all other wish applicationsothers than in /usr/local/bin/wish8.5 directory or soft links from those in /usr/local/bin/wish8.5 and /opt/local/bin/wish directories.

4. TeX

TeX package you'll find at: Just download BasicTeX-2008.dmg, mount the image and run install program. Find the therion.ini file (the path to it is on second line of compilation log - bottom window when run compile in xtherion) and change the path therion will look for metapost and pdftex programs:

### Paths to called executable files ###
  mpost-path    "/usr/texbin/mpost"
  pdftex-path   "/usr/texbin/pdfetex"
  #cavern-path  "cavern"

SnowLeopard: If there are problems with Metapost in compilation time check section QM.09 and QM.10. You should download full instalation of MacTeX here.
Christian Sandrini: When installing TeX make sure to use the big MacTeX application. Otherwise you will get some compilation errors when trying to compile the maps.

5. Survex

Survex package for more sophisticated closure loops:
→ click on MacOS X link, download image and install from it in the usual way.

6. Therion

You may install Therion right now, but without 3D viewer Loch.
Download the Therion package: click on link Source code under paragraph Unstable version… That one is the latest version. Double-click on downloaded file and move the uncompressed folder to your Applications folder. Type in the terminal windov:

cd /Applications/therion [Enter] 
make config-macosx [Enter] 
make [Enter] 

and wait until the compilation has finished. If you receive an error that reads “make[1]: pdftex: Command not found”, you may need to add MacTeX to the beginning of your BASH path:


Then, retry the make command. There could be an error at the end of compilation: “You have not right … tclsh”. In that case try to renew the symbolic link:

sudo ln -s /usr/local/bin/tclsh8.5 /opt/local/bin/tclsh

If there were no errors (excluding Loch) then you may install therion:

sudo make install [Enter]

After install is finished (there should be error message about Loch) you may start Xtherion editor by typing in Terminal window:

xtherion [Enter]

and the Xtherion editor should start.

To use Survex loop closure method you should change two lines in therion.ini file:
Open application TextEdit and press [Command]+O (open file). When dialog window is opened press [Command]+[Shift]+G and write there /etc and press [Enter]. Finder jumps to folder etc. Scroll down to file therion.ini, highlight it and press [Enter]. It will open the file in TextEdit. You should change two lines:
In section ### Prefered loop closure method ### change

# loop-closure therion  to  loop-closure survex (remove #). 

In section ### Paths to called executable files ### change

#cavern-path "cavern" to  cavern-path  "/Applications/Survex/cavern"

(check if the path is OK).

Save As the file to Desktop as therion.ini (check if the name is not the therion.ini.txt!) Open new Finder window (double-click on icon of your system disk or press [Command]+N in Finder. When window is opened press [Command]+[Shift]+G and write there /etc and press [Enter]. Move the therion.ini file from Desktop to etc folder. You should accept “replace original file” and authenticate it.

7. VTK

And now follows the most complicated step - to install VTK (Visualization Toolkit) to run Loch.

Installing VTK on Mac OS X
By drewmccormack at Thu, Jun 7 2007 7:01am 
modified by Martin Sluka May 6 2009 (tested on 10.6.5 December 26 2010)

Mac OS X is a great platform for 3D visualization. It includes OpenGL as standard, which means many existing libraries and applications can easily be ported to the platform. One such library is the Visualization Toolkit (VTK), an open source project run by Kitware, Inc. VTK is at a level above OpenGL: where OpenGL deals with simple polygons, VTK deals with isosurfaces, cut planes, and other 3D actors. It’s at a level useful to scientists, and relatively easy to learn.

VTK works great on the Mac, and even has built in support for Carbon and Cocoa. In the coming weeks, I will show you how to use VTK in Cocoa applications, but in this tutorial we will do a bit of preparation: we are going to compile and install VTK.

Name Your Sources
I want to begin by giving credit where it’s due: most of the information presented here has been stolen from a great piece on the VTK wiki by Ryan Glover. He covers building and installing VTK on the Mac for use with Cocoa, and I will follow his instructions fairly closely here, just adding my experiences where appropriate. I also want to thank Marc Baaden before I get started, because this tutorial, and future ones, were largely inspired by him. He recently rewrote some code that I developed to demonstrate Cocoa and VTK integration many years ago, making it work on the latest versions of Mac OS X. We’ll meet that code in the next tutorial.

Installing CMake
VTK uses an autoconf like tool called CMake to configure the make files used to build VTK. So before you can build VTK, you need to install CMake. Go to the CMake download site and locate the most recent binaries for your system (it doesn't matter that it is written .dmg installer only for Tiger there). The file is called something like cmake-2.x.x-Darwin-universal.dmg. Download it, open the disk image and double click the package to install.

Installing VTK5 (current version VTK6)
Keep a watch of lowercase and uppercase characters. VTK_ALL is not the same as VTK_All!.

Now to VTK itself. Go to the VTK download page and download the latest source files. The file is called something like vtk-x.x.x.tar.gz file. Create folder VTK_All in folder Applications. We will use that path for the rest of this tutorial. Move the downloaded file to folder /Applications/VTK_All. Unpack the sources by double clicking the tar bundle. After unpacking, the sources themselves will be in /Applications/VTK_All/VTK. Now we need to create a couple of folders: one is used for building, and one is for installing the VTK binaries. Create two folders in folder /Applications/VTK_All as follows /VTK_Build and /VTK_Bin. To configure ready for building, change working folder to the VTK_Build folder, and run cmake passing the path to the VTK source root as argument. Write in Terminal window:

cd /Applications/VTK_All/VTK_Build [Enter]
cmake ../VTK [Enter]

This will generate a file called CMakeCache.txt in the VTK_Build folder; this file contains the configuration that will be used to build VTK.

The default configuration may target Carbon, rather than Cocoa, so we need to make a few changes. Use TextEdit to open CMakeCache.txt, and one by one, locate the lines shown below. Edit them as shown.

Thanks to Christian Sandrini:


Check the following line


and change to =ppc or =i386;x86_64 according to processor in your computer. Save the file. Be sure the name of file is still CMakeCache.txt.

To update the build settings based on the changes you just made, rerun cmake from the VTK_Build folder. It will read the CMakeCache.txt file, and propagate the changes to the make files. Make sure you are in VTKBuild folder and issue the command:

cmake ../VTK [Enter]

We are finally ready to compile. Set the following environment variable to target Tiger


and then enter

make -j 2 [Enter]

The -j option will run the build in parallel, so that if you have a multi-core Mac, things will go much faster.

Assuming that all goes well, the last step is to install the binaries in the VTK_Bin folder:

sudo make install [Enter]

With any luck, you should see that /Applications/VTK_All/VT_KBin/ contains include and lib folders, and you are ready to start using VTK in your Cocoa apps.

8. Loch

At the end you need to edit the file Makefile in the loch folder of /Applications/therion folder.

Open Makefile in TextEdit. Find section # PLATFORM MACOSX and check the lines below (Thanks to Christian Sandrini):

  BITTINESS = -m32
  CXX = c++ ${BITTINESS}
  CC = cc ${BITTINESS}
  VTKPATH = /Applications/VTK_All/VTK_Bin
  # change x.x to yours version of VTK  
  VTKINCLUDEPATH = $(VTKPATH)/include/vtk-x.x
  VTKLIBPATH = $(VTKPATH)/lib/vtk-x.x
  VTKLIBS = -lvtkHybrid -lvtkImaging -lvtkIO -lvtkGraphics -lvtkFiltering -lvtkCommon -lvtkjpeg -lvtkpng -lvtkzlib -lvtksys -lfreetype -lGLU -lGL
  POBJECTS = getline.o
  CXXPFLAGS = -W -Wall -DLXMACOSX $(shell wx-config --cxxflags) -I$(VTKINCLUDEPATH) -Wno-deprecated -I/usr/X11R6/include -I/usr/X11R6/include/freetype2
  CCPFLAGS = -W -Wall -DLXMACOSX $(shell wx-config --cflags) -I/usr/X11R6/include
  PLIBS = -lz -L/usr/X11R6/lib $(shell wx-config --libs gl) -L$(VTKLIBPATH) $(VTKLIBS)
  POSTMAKE = cp -f ./loch ./

  Adjust VTK path if needed.

If necessary change the lines according the ones above.

Save Makefile (check the name - Makefile only without any extension).

In Terminal window write:

cd /Applications/therion/loch [Enter]
make [Enter]

The compilation starts run. It should finish without error. Try to write:

open ./ [Enter]

The Loch application should start to run. You may open it by double-clicking from Finder window too. There is still a bug there so you should open the 3D files from application Loch. The double-click on or drag&drop of 3D file doesn't work.

9. Therion Samples

Just as the icing on the cake you may compile the Samples:
Be sure you have Survex ( installed and cavern worked first!

cd /Applications/therion/samples [Enter] 
make [Enter] 

and wait until the compilation finished. You should see folder named samples.doc in the Therion folder. There you will find the html documentation of several interesting features of Therion.

To add samples to the end of therion book you should compile the thbook again but you should to delete the already compiled version of Thbook:

cd /Applications/therion/thbook [Enter]
rm thbook.pdf [Enter] 
make [Enter] 

And that should be all.

Good luck!

Modern MacOS from source (tested 10.14.3)

You shouldn't be an administrator to make install

  • make config-macosx && make && make install

You could also try this Homebrew Formula.

  • masox.txt
  • Last modified: 5 months ago
  • by sluka