Mountain Lion Guide for OpenMW through XCode 4.5

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
User avatar
Posts: 10
Joined: 17 Sep 2012, 19:43
Location: Thessaloniki,GR

Mountain Lion Guide for OpenMW through XCode 4.5

Post by drpaneas » 03 Oct 2012, 19:04

I found problems using brew, problems during compiling OIS and mpg123 and then problems using unixfiles instead of XCode recommended settings. So, this is my way of installing OpenMW into Macbook Air.

Step 1: Install XCode
Update to 4.5 version

Step 2: Register as Appl Develop
and install the Command Line Tools for Xcode (at Downloads)


Xcode 4.5 changed the layout of developer tools on disk which can cause some serious problems for CMake. The issue has been fixed but is not yet publicly released. CMake 2.8.9 will include Xcode 4.5 support. At the time of writing, a release candidate is available that includes this support.

Assuming that Xcode is installed in /Applications,

Code: Select all

sudo xcode-select -switch /Applications/
Step 3: Install macports
Link: use the pkg package
edit your .bash_profile. Add the following lines:
if there is no such file, then create one: touch ~/.bash_profile
edit: open -a TextEdit ~/.bash_profile

Code: Select all

export CPPFLAGS="-I/opt/local/include"
export LDFLAGS="-L/opt/local/lib"
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
Step 4: Install cmake
Link: ... versal.dmg (if you have 64bit which is most likely)

Step 6: Apply in order to compile OIS
Xcode 4 and later users need to first accept the Xcode EULA by either launching Xcode or running

Code: Select all

sudo xcodebuild -license
Step 7: Install dependencies using MacPorts

Code: Select all

sudo port install libpng +universal jpeg +universal libxml2 +universal pkgconfig xmlto autoconf automake libtool freetype +universal freeimage +universal libzzip +universal boost +universal ois +universal libsndfile +universal bullet +universal
Ogre3D requires a 32 bit build due to use of Carbon interfaces via OIS. Thus the +universal specifications to ensure 32 and 64 bit builds for libraries.
You need the first line even if you already have libpng/jpeg/xml2 installed because they will be re-installed within the package system and we need to ensure universal build. You may need --enforce-variants if you have already installed these packages. The build dependencies of libzzip, they do not need to be universal, but use +no_x11 +quartz to avoid unnecessary additional packages

Step 8: Install mpg123 using macports
mpg123: update to 1.14.4; disable SSE optimizations on i386 because they fail to build

Code: Select all

sudo ports install mpg123 +universal
Step 9: Install nVIDIA CG
it automatically add the framework to system's /Library/Frameworks

Step 10: Install Qt4 and qt4-creator

Code: Select all

sudo port install qt4-mac +universal qt4-x11+universal qt4-creator-mac +universal
Step 11: Compile OGRE from source

Code: Select all

tar xjf ogre_src_v1-8-0.tar.bz2
cd ogre_src_v1-8-0
mkdir build
cd build
cmake -GXcode ..
Use the OGRE.xcodeproj and build within Xcode. Then try to launch the SampleBrowser to see for OGRE's examples.

Go into the build folder and move lib/Release/Ogre.framework into /Library/Frameworks

Step 12: Get the CD files ready

Code: Select all

cd /openmw_path
mkdir data
Copy n Paste the following folders and files
* Video (found on the disc)
* Music (found where you unshielded the cabs)
* Sound (found where you unshielded the cabs)
* Splash (found where you unshielded the cabs)
* Morrowind.esm (found in Data_Files after unshielding)
* Morrowind.bsa (found in Data_Files after unshielding)
Step 13: configure for XCode

Code: Select all

cd /openmw_path/
mkdir Build
cd Build
cmake -GXcode ..

Step 14: Use XCode 4.5 for Build and Compile
Open the *.xcodeproj with XCode. Wait to index the fails, apply the warnings into recommended settings (it will save a new snapshot). Build and Compile within XCode.

Step 15: Run
rom your build directory run:
$ open
There are 10 kinds of people. Those who know binary and those who don't.

User avatar
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland

Re: Mountain Lion Guide for OpenMW through XCode 4.5

Post by lgromanowski » 03 Oct 2012, 19:31

Nice guide, would you put it in our wiki?
best regards,

Posts: 493
Joined: 12 Aug 2011, 08:29

Re: Mountain Lion Guide for OpenMW through XCode 4.5

Post by corristo » 04 Oct 2012, 07:00

Good work, man!

I've been too lazy to update current OS X manuals on wiki. Can you add this one there?

Also we should mention in manual that now OpenMW only meant to be built with Ogre version built by hand and installed into /usr/local for example (like you did). SDK wouldn't work. If you have desire & time — we can discuss it and try to fix.

Another note: one can use Homebrew instead of Macports (personally I prefer Homebrew). If you'll add this manual to wiki, I'll add alternative Homebrew commands here. Anyway, Macports way seems easier for beginner because Homebrew lacks some dependencies and one has to install them by hand.

32-bit requirement is not only due to OIS's lack of 64 bit support (OIS distributed with Ogre actually has 64-bit support and uses Cocoa), but because some code should be written to make OpenMW true 64-bit Cocoa app. I tried simple approach (eventloop reading NSEvents), but it had some very strange glitches. Code is here:

If you still had any question regarding OpenMW on OS X feel free to contact me.

P.S. Actually I haven't any problems with CMake & Xcode 4.5 on ML, latest release is built with it.
P.P.S Why not install CMake through MacPorts too?