Skip to content
Johan Frankzén edited this page May 1, 2018 · 8 revisions

This is a small tutorial about how to build OCE sources on Mac OSX Mountain Lion but it should apply to older versions too. (It is probably more detailed than most users need it, but you can never know.)

Note: OCE is now available in Homebrew-science. You can type brew tap brewsci/science && brew install oce into a Terminal in order to install it via brew.

Before you start to build the OCE sources there are a couple things you need to check. Therefore the tutorial will be separated into two sections.

Preparation phase

  • Installing Xcode (with command line tools)

You can get Xcode from the Apple developer site. After installing check if it installed command line tools too. You can do this by writing the following to the terminal:

gcc

If it responds with something like this, than command line tools have been installed.

i686-apple-darwin11-llvm-gcc-4.2: no input files

If it responds with something like this, than command line tools have been not installed.

-bash: gcc: command not found

If it did not get installed, than you can download command line tools form here. (You need to sign in with your Apple ID)

  • Installing Cmake (with command line tools)

You can download it from here. While installing, the installer will ask you if you want to install command line tools, press yes. If you press no, than you have to use the gui (graphical user interface), which is explained here.

  • You need to have X11/Xquartz

X11 under Mountain Lion "changed" to Xquartz. Probably it is not installed by default, but it is easy to check it. Just go to your 'Application/Utilities' folder and start the X11 app. If X11/Xquartz is not installed than it will install automatically!

  • Installing FTGL (OpenGL Font Rendering Library)

The easiest way to get FTGL on your Mac is by downloading MacPorts for example. After you installed MacPorts write the following to the terminal:

sudo port install ftgl

If you want to avoid MacPorts, you can compile it manually. Download the source from ftgl Sourceforge and call: (after you donwloaded the code extract it, open up a terminal, than go to the directory with the cd command - you can read about the cd command in the installing phase - and last run the beneath commands)

./configure && make && sudo make install

if you are using brew ( instead of MacPort), you can install ftgl this way:

brew install ftgl
  • Download the latest OCE and extract it.

When this tutorial was written the latest OCE was 'OCE-0.9.0.tar.gz'

Installing phase

1.Open terminal.

2.Run this command: (You might not need this if you have a lower version than Mountain Lion)

ln -s /opt/X11/include/X11 /usr/local/include/X11

This will set the proper PATH.

3.Then from the Terminal go to the directory where you extracted the OCE file (the name of the original extracted file should be something like tpaviot-oce-6c9a06a).

You can do this with the following terminal command:

cd 'name of the directory'

After the command cd you type the name of the directory with out the quotation marks. Like in this example:

cd Users

If you are not sure what directories are in the directory what you are in, than type in the following:

ls

This will list all the directories what are in that directory where you are at the moment.

4.After you are in the right directory write these commands:

mkdir build 
cd build

5.Now you give out the cmake command:

cmake -DOCE_WITH_FREEIMAGE:BOOL=ON \
-DOCE_WITH_GL2PS:BOOL=ON \
..

You can add more flags to the cmake command like:

-DOCE_INSTALL_PREFIX:PATH=$HOME/OCE \

or

-DOCE_DRAW:BOOL=ON \

But only do this if you know what you are doing! You can read more about the flags here.

6.Last the make commands:

make
make install/strip

Comment

If you did everything how it is written down here, than OCE should be built on your Mac.

The directory where it has been built is the following if you open up a fresh terminal:

cd ..
cd ..
cd usr/local
ls

If you added the following flag to the cmake command:

-DOCE_INSTALL_PREFIX:PATH=$HOME/OCE \

Then it has been installed to your user folder.

If you open up a fresh terminal, than just type in the following:

cd OCE
ls
Clone this wiki locally