Index: source/ps/Util.cpp
===================================================================
--- source/ps/Util.cpp	(revision 10909)
+++ source/ps/Util.cpp	(working copy)
@@ -33,6 +33,7 @@
 #include "lib/sysdep/smbios.h"
 #include "lib/tex/tex.h"
 
+#include "ps/Pyrogenesis.h"
 #include "ps/GameSetup/Config.h"
 #include "ps/GameSetup/GameSetup.h"
 #include "ps/Game.h"
Index: source/ps/Profiler2.cpp
===================================================================
--- source/ps/Profiler2.cpp	(revision 10909)
+++ source/ps/Profiler2.cpp	(working copy)
@@ -28,6 +28,7 @@
 #include "ps/CLogger.h"
 #include "ps/CStr.h"
 #include "ps/Profiler2GPU.h"
+#include "ps/Pyrogenesis.h"
 #include "third_party/mongoose/mongoose.h"
 
 #include <iomanip>
Index: source/ps/ProfileViewer.cpp
===================================================================
--- source/ps/ProfileViewer.cpp	(revision 10909)
+++ source/ps/ProfileViewer.cpp	(working copy)
@@ -27,6 +27,7 @@
 
 #include "ProfileViewer.h"
 
+#include "ps/Pyrogenesis.h"
 #include "ps/CLogger.h"
 #include "ps/Filesystem.h"
 #include "ps/Font.h"
Index: source/ps/Replay.cpp
===================================================================
--- source/ps/Replay.cpp	(revision 10909)
+++ source/ps/Replay.cpp	(working copy)
@@ -24,6 +24,7 @@
 #include "lib/file/file_system.h"
 #include "lib/res/h_mgr.h"
 #include "lib/tex/tex.h"
+#include "ps/Pyrogenesis.h"
 #include "ps/Game.h"
 #include "ps/Loader.h"
 #include "ps/Profile.h"
Index: source/ps/GameSetup/Paths.cpp
===================================================================
--- source/ps/GameSetup/Paths.cpp	(revision 10909)
+++ source/ps/GameSetup/Paths.cpp	(working copy)
@@ -54,6 +54,14 @@
 		m_config = appdata/"config"/"";
 		m_cache = appdata/"cache"/"";
 		m_logs = appdata/"logs"/"";
+#elif defined __APPLE__
+		const char* envHome = getenv("HOME");
+		ENSURE(envHome);
+		const OsPath home(envHome);
+		m_data   = home/"Library/Application Support/0AD/data/";
+		m_cache  =  home/"Library/Application Support/0AD/cache/";
+		m_config =  home/"Library/Application Support/0AD/config/";
+		m_logs   =  home/"Library/Application Support/0AD/logs/";
 #else
 		const char* envHome = getenv("HOME");
 		ENSURE(envHome);
@@ -86,8 +94,12 @@
 	if(!FileExists(pathname))
 		WARN_IF_ERR(StatusFromErrno());
 
+#ifndef MAC_NATIVE  //  when running natively on a mac, i.e. with a proper app bundle our data is inside the app wrapper instead of next to it
 	for(size_t i = 0; i < 2; i++)	// remove "system/name.exe"
 		pathname = pathname.Parent();
+#endif
+
+
 	return pathname;
 }
 
Index: source/ps/DllLoader.cpp
===================================================================
--- source/ps/DllLoader.cpp	(revision 10909)
+++ source/ps/DllLoader.cpp	(working copy)
@@ -89,6 +89,10 @@
 		{
 			CStr filename = GenerateFilename(name, suffixes[idxSuffix], extensions[idxExtension]);
 
+#ifdef MAC_NATIVE // when running natively on a mac, i.e. with a proper app bundle our dylib is inside the app wrapper instead of next to it
+			filename = "@executable_path/" + filename;
+#endif
+
 			// we don't really care when relocations take place, but one of
 			// {RTLD_NOW, RTLD_LAZY} must be specified. go with the former because
 			// it is safer and matches the Windows load behavior.
Index: source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinematic/Cinematic.cpp
===================================================================
--- source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinematic/Cinematic.cpp	(revision 10909)
+++ source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Cinematic/Cinematic.cpp	(working copy)
@@ -490,7 +490,7 @@
 		
 		displayH->Add(m_SplineDisplay, 0);
 		displayH->Add(m_RotationDisplay, 0);
-		m_Sizer->Add(displayH, 0, wxTop | wxALIGN_CENTER, 10);
+		m_Sizer->Add(displayH, 0, wxALIGN_TOP | wxALIGN_CENTER, 10);
 		m_Sizer->Add(m_DrawCurrent, 0);
 		m_Sizer->Add( new wxButton(this, Reset_ID, L"Reset Camera"), 0, wxALIGN_CENTER );
 	}
Index: source/tools/atlas/AtlasUI/Misc/KeyMap.cpp
===================================================================
--- source/tools/atlas/AtlasUI/Misc/KeyMap.cpp	(revision 10909)
+++ source/tools/atlas/AtlasUI/Misc/KeyMap.cpp	(working copy)
@@ -19,7 +19,7 @@
 
 #include "KeyMap.h"
 
-#include "SDL_keysym.h"
+#include <SDL/SDL_keysym.h>
 
 int GetSDLKeyFromWxKeyCode(int wxkey)
 {
Index: source/tools/atlas/AtlasUI/CustomControls/ColourDialog/ColourDialog.h
===================================================================
--- source/tools/atlas/AtlasUI/CustomControls/ColourDialog/ColourDialog.h	(revision 10909)
+++ source/tools/atlas/AtlasUI/CustomControls/ColourDialog/ColourDialog.h	(working copy)
@@ -18,7 +18,7 @@
 #ifndef INCLUDED_COLOURDIALOG
 #define INCLUDED_COLOURDIALOG
 
-#include <wx/colordlg.h>
+#include "wx/colordlg.h"
 
 class ColourDialog : public wxColourDialog
 {
Index: source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/virtualdirtreectrl.h
===================================================================
--- source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/virtualdirtreectrl.h	(revision 10909)
+++ source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/virtualdirtreectrl.h	(working copy)
@@ -30,10 +30,10 @@
     #include "wx/wx.h"
 #endif
 
-#include <wx/dynarray.h>
-#include <wx/treectrl.h>
-#include <wx/filesys.h>
-#include <wx/imaglist.h>
+#include "wx/dynarray.h"
+#include "wx/treectrl.h"
+#include "wx/filesys.h"
+#include "wx/imaglist.h"
 
 enum
 {
Index: source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/virtualdirtreectrl.cpp
===================================================================
--- source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/virtualdirtreectrl.cpp	(revision 10909)
+++ source/tools/atlas/AtlasUI/CustomControls/VirtualDirTreeCtrl/virtualdirtreectrl.cpp	(working copy)
@@ -32,8 +32,8 @@
     #pragma hdrstop
 #endif
 
-#include <wx/dir.h>
-#include <wx/busyinfo.h>
+#include "wx/dir.h"
+#include "wx/busyinfo.h"
 #include "virtualdirtreectrl.h"
 
 // default images
Index: source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp
===================================================================
--- source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp	(revision 10909)
+++ source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp	(working copy)
@@ -66,7 +66,7 @@
 
 	s.skyset = g_Renderer.GetSkyManager()->GetSkySet();
 
-	// RGBColor (CVector3D) colours
+	// RGBColorVector (CVector3D) colours
 #define COLOUR(A, B) A = Colour((int)(B.X*255), (int)(B.Y*255), (int)(B.Z*255))
 	s.sunoverbrightness = MaxComponent(g_LightEnv.m_SunColor);
 	// clamp color to [0..1] before packing into u8 triplet
@@ -112,7 +112,7 @@
 		skySet = L"default";
 	g_Renderer.GetSkyManager()->SetSkySet(skySet);
 
-#define COLOUR(A, B) B = RGBColor(A->r/255.f, A->g/255.f, A->b/255.f)
+#define COLOUR(A, B) B = RGBColorVector(A->r/255.f, A->g/255.f, A->b/255.f)
 	COLOUR(s.suncolour, g_LightEnv.m_SunColor);
 	g_LightEnv.m_SunColor *= s.sunoverbrightness;
 	COLOUR(s.terraincolour, g_LightEnv.m_TerrainAmbientColor);
Index: source/graphics/ParticleEmitterType.cpp
===================================================================
--- source/graphics/ParticleEmitterType.cpp	(revision 10909)
+++ source/graphics/ParticleEmitterType.cpp	(working copy)
@@ -539,7 +539,7 @@
 
 			particle.size = m_Variables[VAR_SIZE]->Evaluate(emitter);
 
-			RGBColor color;
+			RGBColorVector color;
 			color.X = m_Variables[VAR_COLOR_R]->Evaluate(emitter);
 			color.Y = m_Variables[VAR_COLOR_G]->Evaluate(emitter);
 			color.Z = m_Variables[VAR_COLOR_B]->Evaluate(emitter);
Index: source/graphics/MapReader.cpp
===================================================================
--- source/graphics/MapReader.cpp	(revision 10909)
+++ source/graphics/MapReader.cpp	(working copy)
@@ -593,7 +593,7 @@
 		}
 		else if (element_name == el_suncolour)
 		{
-			m_MapReader.m_LightEnv.m_SunColor = RGBColor(
+			m_MapReader.m_LightEnv.m_SunColor = RGBColorVector(
 				attrs.GetNamedItem(at_r).ToFloat(),
 				attrs.GetNamedItem(at_g).ToFloat(),
 				attrs.GetNamedItem(at_b).ToFloat());
@@ -608,14 +608,14 @@
 		}
 		else if (element_name == el_terrainambientcolour)
 		{
-			m_MapReader.m_LightEnv.m_TerrainAmbientColor = RGBColor(
+			m_MapReader.m_LightEnv.m_TerrainAmbientColor = RGBColorVector(
 				attrs.GetNamedItem(at_r).ToFloat(),
 				attrs.GetNamedItem(at_g).ToFloat(),
 				attrs.GetNamedItem(at_b).ToFloat());
 		}
 		else if (element_name == el_unitsambientcolour)
 		{
-			m_MapReader.m_LightEnv.m_UnitsAmbientColor = RGBColor(
+			m_MapReader.m_LightEnv.m_UnitsAmbientColor = RGBColorVector(
 				attrs.GetNamedItem(at_r).ToFloat(),
 				attrs.GetNamedItem(at_g).ToFloat(),
 				attrs.GetNamedItem(at_b).ToFloat());
@@ -1302,18 +1302,18 @@
 
 	CColor sunColor;
 	GET_ENVIRONMENT_PROPERTY(envObj.get(), SunColour, sunColor)
-	m_LightEnv.m_SunColor = RGBColor(sunColor.r, sunColor.g, sunColor.b);
+	m_LightEnv.m_SunColor = RGBColorVector(sunColor.r, sunColor.g, sunColor.b);
 
 	GET_ENVIRONMENT_PROPERTY(envObj.get(), SunElevation, m_LightEnv.m_Elevation)
 	GET_ENVIRONMENT_PROPERTY(envObj.get(), SunRotation, m_LightEnv.m_Rotation)
 	
 	CColor terrainAmbientColor;
 	GET_ENVIRONMENT_PROPERTY(envObj.get(), TerrainAmbientColour, terrainAmbientColor)
-	m_LightEnv.m_TerrainAmbientColor = RGBColor(terrainAmbientColor.r, terrainAmbientColor.g, terrainAmbientColor.b);
+	m_LightEnv.m_TerrainAmbientColor = RGBColorVector(terrainAmbientColor.r, terrainAmbientColor.g, terrainAmbientColor.b);
 
 	CColor unitsAmbientColor;
 	GET_ENVIRONMENT_PROPERTY(envObj.get(), UnitsAmbientColour, unitsAmbientColor)
-	m_LightEnv.m_UnitsAmbientColor = RGBColor(unitsAmbientColor.r, unitsAmbientColor.g, unitsAmbientColor.b);
+	m_LightEnv.m_UnitsAmbientColor = RGBColorVector(unitsAmbientColor.r, unitsAmbientColor.g, unitsAmbientColor.b);
 
 	// Water properties
 	CScriptValRooted waterObj;
Index: source/graphics/Color.h
===================================================================
--- source/graphics/Color.h	(revision 10909)
+++ source/graphics/Color.h	(working copy)
@@ -28,12 +28,12 @@
 
 // simple defines for 3 and 4 component floating point colors - just map to
 // corresponding vector types
-typedef CVector3D RGBColor;
-typedef CVector4D RGBAColor;
+typedef CVector3D RGBColorVector;
+typedef CVector4D RGBAColorVector;
 
 // exposed as function pointer because it is set at init-time to
 // one of several implementations depending on CPU caps.
-extern SColor4ub (*ConvertRGBColorTo4ub)(const RGBColor& src);
+extern SColor4ub (*ConvertRGBColorTo4ub)(const RGBColorVector& src);
 
 // call once ia32_Init has run; detects CPU caps and activates the best
 // possible codepath.
Index: source/graphics/tests/test_Color.h
===================================================================
--- source/graphics/tests/test_Color.h	(revision 10909)
+++ source/graphics/tests/test_Color.h	(working copy)
@@ -39,7 +39,7 @@
 private:
 	void CheckColor(int r, int g, int b, u32 expected)
 	{
-		SColor4ub colorStruct = ConvertRGBColorTo4ub(RGBColor(r,g,b));
+		SColor4ub colorStruct = ConvertRGBColorTo4ub(RGBColorVector(r,g,b));
 		u32 actual;
 		memcpy(&actual, &colorStruct, sizeof(u32));
 		expected |= 0xff000000;	// ConvertRGBColorTo4ub sets alpha to opaque 
Index: source/graphics/LightEnv.h
===================================================================
--- source/graphics/LightEnv.h	(revision 10909)
+++ source/graphics/LightEnv.h	(working copy)
@@ -70,9 +70,9 @@
 	std::string m_LightingModel;
 
 public:
-	RGBColor m_SunColor;
-	RGBColor m_TerrainAmbientColor;
-	RGBColor m_UnitsAmbientColor;
+	RGBColorVector m_SunColor;
+	RGBColorVector m_TerrainAmbientColor;
+	RGBColorVector m_UnitsAmbientColor;
 
 public:
 	CLightEnv();
@@ -98,7 +98,7 @@
 	 * @param normal normal vector (must have length 1)
 	 * @param color resulting color
 	 */
-	void EvaluateTerrain(const CVector3D& normal, RGBColor& color) const
+	void EvaluateTerrain(const CVector3D& normal, RGBColorVector& color) const
 	{
 		float dot = -normal.Dot(m_SunDir);
 
@@ -115,7 +115,7 @@
 	 * @param normal normal vector (must have length 1)
 	 * @param color resulting color
 	 */
-	void EvaluateUnit(const CVector3D& normal, RGBColor& color) const
+	void EvaluateUnit(const CVector3D& normal, RGBColorVector& color) const
 	{
 		float dot = -normal.Dot(m_SunDir);
 
@@ -131,7 +131,7 @@
 	 * @param normal normal vector (must have length 1)
 	 * @param color resulting color
 	 */
-	void EvaluateDirect(const CVector3D& normal, RGBColor& color) const
+	void EvaluateDirect(const CVector3D& normal, RGBColorVector& color) const
 	{
 		float dot = -normal.Dot(m_SunDir);
 
Index: source/graphics/Color.cpp
===================================================================
--- source/graphics/Color.cpp	(revision 10909)
+++ source/graphics/Color.cpp	(working copy)
@@ -31,7 +31,7 @@
 # include "lib/sysdep/arch/x86_x64/x86_x64.h"
 #endif
 
-static SColor4ub fallback_ConvertRGBColorTo4ub(const RGBColor& src)
+static SColor4ub fallback_ConvertRGBColorTo4ub(const RGBColorVector& src)
 {
 	SColor4ub result;
 	result.R=clamp(int(src.X*255),0,255);
@@ -42,12 +42,12 @@
 }
 
 // on IA32, this is replaced by an SSE assembly version in ia32.cpp
-SColor4ub (*ConvertRGBColorTo4ub)(const RGBColor& src) = fallback_ConvertRGBColorTo4ub;
+SColor4ub (*ConvertRGBColorTo4ub)(const RGBColorVector& src) = fallback_ConvertRGBColorTo4ub;
 
 
 // Assembler-optimized function for color conversion
 #if ARCH_X86_X64
-static SColor4ub sse_ConvertRGBColorTo4ub(const RGBColor& src)
+static SColor4ub sse_ConvertRGBColorTo4ub(const RGBColorVector& src)
 {
 	const __m128 zero = _mm_setzero_ps();
 	const __m128 _255 = _mm_set_ss(255.0f);
Index: source/renderer/ModelRenderer.cpp
===================================================================
--- source/renderer/ModelRenderer.cpp	(revision 10909)
+++ source/renderer/ModelRenderer.cpp	(working copy)
@@ -129,7 +129,7 @@
 	size_t numVertices = mdef->GetNumVertices();
 	const CLightEnv& lightEnv = g_Renderer.GetLightEnv();
 	CColor shadingColor = model->GetShadingColor();
-	RGBColor tempcolor;
+	RGBColorVector tempcolor;
 
 	for (size_t j=0; j<numVertices; j++)
 	{
Index: source/renderer/TerrainRenderer.cpp
===================================================================
--- source/renderer/TerrainRenderer.cpp	(revision 10909)
+++ source/renderer/TerrainRenderer.cpp	(working copy)
@@ -297,7 +297,7 @@
 
 	glBlendFunc(GL_DST_COLOR, GL_ZERO);
 
-	// GL_TEXTURE_ENV_COLOR requires four floats, so we shouldn't use the RGBColor directly
+	// GL_TEXTURE_ENV_COLOR requires four floats, so we shouldn't use the RGBColorVector directly
 	float terrainAmbientColor[4] = {
 		lightEnv.m_TerrainAmbientColor.X,
 		lightEnv.m_TerrainAmbientColor.Y,
Index: source/lib/external_libraries/libsdl.h
===================================================================
--- source/lib/external_libraries/libsdl.h	(revision 10909)
+++ source/lib/external_libraries/libsdl.h	(working copy)
@@ -34,14 +34,14 @@
 # include "lib/sysdep/os/win/wsdl.h"
 #else
 
-# include "SDL.h"
-# include "SDL_thread.h"
+# include "SDL/SDL.h"
+# include "SDL/SDL_thread.h"
 
 // if the compiler doesn't support inlining, this header will pull
 // in static bswap routines. doesn't matter - modern compilers
 // will strip them if unused, and this is more convenient than
 // another header that toggles between wsdl and SDL_endian.h.
-# include "SDL_endian.h"
+# include "SDL/SDL_endian.h"
 
 # if MSC_VERSION
 #  pragma comment(lib, "SDL")
