Compiling XTrkCad from source on Mac OSX

Standard

Well it’s railway time and I’m finding that my plans are far more elaborate than ever before so I need a way of planning the layout so I can test various turnouts and track combinations before I have to start cutting track etc. No bother when there is great software out there to help you and XTrkCad is just such a great (and open source) piece of software – but why would I ever need to build it from scratch?

My problems seem to be related to 1) Apple OSX Lion changed a lot of the underlying libraries and it breaks XTrkCad and 2) I want to tweak the software and generally fix it up on Mac. So, if you are interested in this too please follow along!

    1. If you do not already have it install darwin ports to help manage various unix packages on Mac – head to http://www.macports.org/install.php and follow their instructions
  • Ensure that you have X11 installed on your Mac (comes with the install DVD but may not be installed by default)
  • Install some required software using ports:
    sudo port install mercurial gtk2 webkit-gtk
  • Get the XTrkCad source code
    hg clone http://xtrkcad-fork.hg.sourceforge.net:8000/hgroot/xtrkcad-fork/xtrkcad
  • Now we want to compile…
    cd xtrkcad
    cmake .
    make
    sudo make install

    You can now run the program by executing /usr/local/bin/xtrkcad on the command line. If you would like to create a more familiar looking .app bundle then you should:

    make package
    sudo cp -r ./_CPack_Packages/Darwin/Bundle/xtrkcad-setup-4.2.0beta1-i386/XTrackCAD.app /Applications/

    Now you have the latest XTrkCad on your machine you can have a little fun. If this does not work out give me a shout and I will update my docs. I hope to get the app build updated on the website soon so this is not necessary by all users of XTrkCad in OSX Lion.