This guide describes how to get TrinityCore running on Mac OS X.

Mac OS X ships with several libraries including OpenSSL and a special version of Readline - both required by TrinityCore. But: They are useless. OpenSSL is too old and Readline is... well... special. So we have to build the right ones. This is fairly easy and by doing this on your own (using programs like MacPorts or Homebrew is the alternative) you may learn more about libraries, your Mac and its handling on a non-graphic way. But no matter what you're doing in this guide there is one rule you should remind and never ever break:

DO NOT INSTALL ANYTHING YOU BUILD IN THIS GUIDE TO A SYSTEM-RELEVANT PATH! Rather use a path in your home directory.

Setting up the environment

We're going to put all the TrinityCore stuff to your home directory in the next step, even the installed binaries. We need to tell TrinityCore where its libraries are installed to. Further I guess you simply want to type "cmake" or "mysql" instead of "/Users/<Username>/Trinity/bin/cmake" or "/usr/local/mysql/bin/mysql". So we gonna set up a profile file which extends the default PATH and DYLD_LIBRARY_PATH variable and create a folder for the TrinityCore stuff:

mkdir ~/Trinity
nano ~/.profile

Add the following lines:

export TRINITY=/Users/<Username>/Trinity
export PATH=$PATH:$TRINITY/bin:/usr/local/mysql/bin
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$TRINITY/lib:/usr/local/mysql/lib

Press Ctrl+O followed by Ctrl+X to save and close the file. Done. Quit the termial application and restart it.

There is also an autocompletion script for git which can be downloaded and included here.

curl -o ~/.gitcompletion "https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash"
nano ~/.profile

Add the following line:

source ~/.gitcompletion

Press Ctrl+O followed by Ctrl+X to save and close the file. Done. Quit the termial application and restart it.

Building the libraries

Open a terminal and change to your download folder. Safari automatically extracts .gz archives and leaves the tar ball.

OpenSSL

tar xvf openssl-1.0.1j.tar
cd openssl-1.0.1j
./Configure darwin64-x86_64-cc shared --prefix=$TRINITY
make -j 2
make install
cd ..

Readline

tar xvf readline-6.3.tar
cd readline-6.3
./configure --prefix=$TRINITY
make -j 2
make install
cd ..

CMake

tar xvf cmake-3.0.2.tar
cd cmake-3.0.2
./bootstrap --prefix=$TRINITY
make -j 2
make install
cd .. 

Boost

tar xvf boost_1_56_0.tar
cd boost_1_56_0
./bootstrap.sh --with-libraries=system,thread,program_options --prefix=$TRINITY
./b2 -j2
./b2 install
cd .. 

Installing TrinityCore

You successfully installed all the dependencies. Now it's time to install the server.

Obtaining the source and preparing the build

cd $TRINITY
git clone https://github.com/TrinityCore/TrinityCore.git repo
mkdir build
cd build

Generate the Xcode project files using CMake:

cmake ../repo -GXcode \
-DMYSQL_ADD_INCLUDE_PATH=/usr/local/mysql/include \
-DMYSQL_LIBRARY=/usr/local/mysql/lib/libmysqlclient_r.dylib \
-DREADLINE_INCLUDE_DIR=$TRINITY/include \
-DREADLINE_LIBRARY=$TRINITY/lib/libreadline.dylib \
-DBOOST_INCLUDEDIR=$TRINITY/include \
-DBOOST_LIBRARYDIR=$TRINITY/lib \
-DOPENSSL_SSL_LIBRARIES=$TRINITY/lib/libssl.dylib \
-DOPENSSL_CRYPTO_LIBRARIES=$TRINITY/lib/libcrypto.dylib \
-DOPENSSL_INCLUDE_DIR=$TRINITY/include \
-DPREFIX=$TRINITY \
-DWITH_WARNINGS=1

Building the binaries

This step may take a while and needs to be done every time the source code changes. Afterwards you'll find the binaries in "/Users/<Username>/Trinity/bin"

xcodebuild -target install -config Debug

Keeping the code up to date

cd $TRINITY/repo
git reset --hard HEAD
git pull

Repeat the steps described in "Building the binaries".

Setting up the server

... this part needs to be re-written. Coming soon!

Quote of Vincent-Michael:

Mac sucks! Use Windows or Linux!

Comments:

It may work but uses many non-standard tools (self built GCC), modifications and old libraries (SDK 10.6).

Posted by gacko28 at Mar 01, 2014 19:07

It works. And it's an easy way to start Trinity Core on Mac. Not the best but a way however (smile)

Posted by ludyana.paragon@gmail.com at Mar 01, 2014 19:22

you can also use with sdk 10.8

Posted by jeremymeile at Mar 25, 2014 20:29

Hm, my last tries even worked with 10.9 (wink) Guess it has something to do with C++11. But I don't know. This is why I dropped the deployment target line in the CMake script.

Posted by gacko28 at Apr 01, 2014 20:35

works for me

Posted by shindarth at Apr 20, 2014 18:13

ShinDarth, I really like when somebody cares about Mac and TrinityCore. But: I removed all usages of sudo and system paths because it's possible (and better for "newbies") to run TrinityCore in their home path. Further creating a .profile is used by every shell, not only bash. Extending the path variable is far better than sym-linking cmake to a system path.

Posted by gacko28 at Apr 20, 2014 18:29

Gacko. I am totally a newbies and i want set up the TrinityCore on my mac , But why the set up the server session is empty? It's confused 

Posted by visperc at Sep 25, 2014 15:53

Hey Jimmy,

unfortunately I did not write it yet. There will be a generic setup guide in future if I remember correctly. Anyway: You can try the Linux guide as most things are the same for Mac (wink)

Good Luck!

Gacko

Posted by gacko28 at Sep 29, 2014 09:53