Compiling for OS X

From The Powder Toy
Revision as of 10:01, 1 August 2014 by minecraft-physics (talk | contribs) (Enter a short summary [ctrl-option-b])
Jump to: navigation, search

Note: This page is only for OS X (10.7, 10.8, 10.9) It may not work on 10.6 and below Note: This guide is untested, it may not work (possibility of lua errors or errors when running the final version). If there are problems, try posting your errors on the development help section of the forums, or coming onto irc.

1. Download Xcode from the App Store link

2. Download xQuartz link

3. Download SDL link

4. This should download to your downloads folder. Keep uncompressing until it becomes a folder.

5. If you are running Mavericks (10.9); it gets a bit more involved. If not, skip to the step 6.

5a. Find the SDL folder (It should say "SDL-1.2.15" without the quotes) and open it. Then navigate to SDL-1.2.5/src/video/quartz

5b. Right Click (or control-click) on SDL_QuartzVideo.h and go to Open With > TextEdit (you can use Xcode if you want, but you don't need to.)

5c. In TextEdit, go to Edit > Find > Find.. and type CGDirectPaletteRef into the search box. Delete the entire line of code you find it in (delete CGDirectPaletteRef palette; /* palette of an 8-bit display */)

5d. Close the window.

6. In terminal, type cd (<-- Make sure there is a space after) and then drag the SDL folder in.

7. type in (or copy / paste) ./configure && make If that comes up with an error, go to this page and download 'Command Line Tools for OS X'.

There are several versions. Make sure to download the correct one.. If you don't know which you are using, go to the apple in the top left hand corner and press about my mac.

8. After that, install SDL by typing in sudo make install It will ask you for your password. Type it in and press enter.

9. Now, download scons and unzip it. Go into the terminal, and type in cd with a space after it and drag in the folder that you downloaded. Next type sudo python setup.py install. The terminal will ask you for your password. Note that you can not see your password while you are typing it in. You now have scons installed.

10. If you have MacHomeBrew installed, install lua by typing brew install lua. You now have lua installed.

11. Go into the folder with the source code that you downloaded. Open up terminal again and type cd with a space after it. Drag in the folder with the source code.

12. Next type this into Terminal: scons --macosx --release --sse2 --nofft. It will start compiling.

If it compiled without errors, you will find a file called powder-x in the build folder. Double click it and run it. Congrats, you have compiled spare code and have made a OS X application.

This was written by Candunc and rewritten by jmeyer2k, although parts were copied from the Mac OS X compile page. Thanks to the editors on the Mac OS X compile page, and thanks to people at Mac Rumors and Ximon to help me find out various errors.

I hope this helps future users become Mac Compilers and push TPT to Mac users!