diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h
index 5a38d54eea30034cd18a80a0f87df8c61fc0a21c..91f45d4f5ff70af48dd834b5bd8b0b4fb99c09de 100644
--- a/indra/llcommon/llthreadlocalstorage.h
+++ b/indra/llcommon/llthreadlocalstorage.h
@@ -152,43 +152,48 @@ class LLThreadLocalSingleton
 	virtual ~LLThreadLocalSingleton()
 	{
 		sInstance = NULL;
-		sInitState = DELETED;
+		setInitState(DELETED);
 	}
 
 	static void deleteSingleton()
 	{
 		delete sInstance;
 		sInstance = NULL;
-		sInitState = DELETED;
+		setInitState(DELETED);
 	}
 
 	static DERIVED_TYPE* getInstance()
 	{
-		if (sInitState == CONSTRUCTING)
+        EInitState init_state = getInitState();
+		if (init_state == CONSTRUCTING)
 		{
 			llerrs << "Tried to access singleton " << typeid(DERIVED_TYPE).name() << " from singleton constructor!" << llendl;
 		}
 
-		if (sInitState == DELETED)
+		if (init_state == DELETED)
 		{
 			llwarns << "Trying to access deleted singleton " << typeid(DERIVED_TYPE).name() << " creating new instance" << llendl;
 		}
 
-		if (!sInstance) 
+		if (!getIfExists())
 		{
-			sInitState = CONSTRUCTING;
+			setInitState(CONSTRUCTING);
 			sInstance = new DERIVED_TYPE(); 
-			sInitState = INITIALIZING;
+			setInitState(INITIALIZING);
 			sInstance->initSingleton(); 
-			sInitState = INITIALIZED;	
+			setInitState(INITIALIZED);
 		}
 
-		return sInstance;
+        return getIfExists();
 	}
 
 	static DERIVED_TYPE* getIfExists()
 	{
+#if LL_DARWIN
+        return sInstance.get();
+#else
 		return sInstance;
+#endif
 	}
 
 	// Reference version of getInstance()
@@ -202,16 +207,33 @@ class LLThreadLocalSingleton
 	// Use this to avoid accessing singletons before the can safely be constructed
 	static bool instanceExists()
 	{
-		return sInitState == INITIALIZED;
+		return getInitState() == INITIALIZED;
 	}
 
 	// Has this singleton already been deleted?
 	// Use this to avoid accessing singletons from a static object's destructor
 	static bool destroyed()
 	{
-		return sInitState == DELETED;
+		return getInitState() == DELETED;
 	}
 private:
+    static EInitState getInitState()
+    {
+#if LL_DARWIN
+        return (EInitState)(int)sInitState.get();
+#else
+        return sInitState;
+#endif
+    }
+    
+    static void setInitState(EInitState state)
+    {
+#if LL_DARWIN
+        sInitState = (int*)state;
+#else
+        sInitState = state;
+#endif
+    }
 	LLThreadLocalSingleton(const LLThreadLocalSingleton& other);
 	virtual void initSingleton() {}
 
@@ -221,10 +243,13 @@ class LLThreadLocalSingleton
 #elif LL_LINUX
 	static __thread DERIVED_TYPE* sInstance;
 	static __thread EInitState sInitState;
+#elif LL_DARWIN
+    static LLThreadLocalPointer<DERIVED_TYPE> sInstance;
+    static LLThreadLocalPointer<int> sInitState;
 #endif
 };
 
-#ifdef LL_WINDOWS
+#if LL_WINDOWS
 template<typename DERIVED_TYPE>
 __declspec(thread) DERIVED_TYPE* LLThreadLocalSingleton<DERIVED_TYPE>::sInstance = NULL;
 
@@ -236,6 +261,12 @@ __thread DERIVED_TYPE* LLThreadLocalSingleton<DERIVED_TYPE>::sInstance = NULL;
 
 template<typename DERIVED_TYPE>
 __thread typename LLThreadLocalSingleton<DERIVED_TYPE>::EInitState LLThreadLocalSingleton<DERIVED_TYPE>::sInitState = LLThreadLocalSingleton<DERIVED_TYPE>::UNINITIALIZED;
+#elif LL_DARWIN
+template<typename DERIVED_TYPE>
+LLThreadLocalPointer<DERIVED_TYPE> LLThreadLocalSingleton<DERIVED_TYPE>::sInstance;
+
+template<typename DERIVED_TYPE>
+LLThreadLocalPointer<int> LLThreadLocalSingleton<DERIVED_TYPE>::sInitState;
 #endif
 
 template<typename DERIVED_TYPE>
@@ -249,7 +280,11 @@ class LLThreadLocalSingletonPointer
 
 	LL_FORCE_INLINE static DERIVED_TYPE* getInstance()
 	{
+#if LL_DARWIN
+        return sInstance.get();
+#else
 		return sInstance;
+#endif
 	}
 
 	LL_FORCE_INLINE static void setInstance(DERIVED_TYPE* instance)
@@ -258,18 +293,24 @@ class LLThreadLocalSingletonPointer
 	}
 
 private:
-#ifdef LL_WINDOWS
+#if LL_WINDOWS
 	static __declspec(thread) DERIVED_TYPE* sInstance;
 #elif LL_LINUX
 	static __thread DERIVED_TYPE* sInstance;
+#elif LL_DARWIN
+    static LLThreadLocalPointer<DERIVED_TYPE> sInstance;
 #endif
 };
 
+#if LL_WINDOWS
 template<typename DERIVED_TYPE>
-#ifdef LL_WINDOWS
 __declspec(thread) DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL;
 #elif LL_LINUX
+template<typename DERIVED_TYPE>
 __thread DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL;
+#elif LL_DARWIN
+template<typename DERIVED_TYPE>
+LLThreadLocalPointer<DERIVED_TYPE> LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance;
 #endif
 
 #endif // LL_LLTHREADLOCALSTORAGE_H
diff --git a/indra/media_plugins/webkit/mac_volume_catcher.cpp b/indra/media_plugins/webkit/mac_volume_catcher.cpp
index 8a06bb8487efd1d0a4832adace148a3e0067d9f6..c20bcd374dba2c560c8442334987a8ec4a1ecbe1 100644
--- a/indra/media_plugins/webkit/mac_volume_catcher.cpp
+++ b/indra/media_plugins/webkit/mac_volume_catcher.cpp
@@ -38,6 +38,7 @@
 #include <Carbon/Carbon.h>
 #include <QuickTime/QuickTime.h>
 #include <AudioUnit/AudioUnit.h>
+#include <list>
 
 struct VolumeCatcherStorage;
 
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 32ed66254847c37ffc7cbb95a73332b107280e5c..ba298ed819c87c64f4f5ae22730be75e8e28ee6b 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -514,7 +514,7 @@ void LLFastTimerView::draw()
 			else
 			{
 				ms = LLUnit<LLUnits::Seconds, F64>(frame_recording.getPeriodMean(*idp));
-				calls = (S32)frame_recording.getPeriodMean((F32)idp->callCount());
+				calls = (S32)frame_recording.getPeriodMean(idp->callCount());
 			}
 
 			if (mDisplayCalls)
diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp
index 7f17fd3e5626efe95d9a38314b70cbe6ecdb3607..717f215d3d17a6287e553fec59cc48c1402f5fb6 100644
--- a/indra/newview/llvowlsky.cpp
+++ b/indra/newview/llvowlsky.cpp
@@ -394,7 +394,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
 			segment->flush();
 		}
 	
-		llinfos << "completed in " << llformat("%.2f", timer.getElapsedTimeF32()) << "seconds" << llendl;
+		llinfos << "completed in " << llformat("%.2f", timer.getElapsedTimeF32().value()) << "seconds" << llendl;
 	}
 #else
 	mStripsVerts = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);