diff --git a/bob/buildout/envwrapper.py b/bob/buildout/envwrapper.py
index d3066d006c998f36ea539c50322dbe6fd4067123..d3169021406dc1f8f1d64650c4fedf637c769808 100644
--- a/bob/buildout/envwrapper.py
+++ b/bob/buildout/envwrapper.py
@@ -30,6 +30,7 @@ class EnvironmentWrapper(object):
 
   if platform.system() == 'Darwin':
     DEBUG_CFLAGS += ' -pthread'
+    RELEASE_CFLAGS += ' -pthread'
     LDFLAGS = '-lpthread'
 
   # Note: CLang does not work well with BZ_DEBUG\n
diff --git a/bob/buildout/test_envwrapper.py b/bob/buildout/test_envwrapper.py
index 7eb558ea9d22525d0edb1c73bbdc413b845fff7d..9e23c9c101350deca38b41189f7659a657c84e3d 100644
--- a/bob/buildout/test_envwrapper.py
+++ b/bob/buildout/test_envwrapper.py
@@ -12,6 +12,15 @@ import platform
 
 from .envwrapper import EnvironmentWrapper
 
+def cleanup():
+  '''Removes weird variables from the user environment just for the tests'''
+
+  remove = ['CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'BOB_PREFIX_PATH',
+      'PKG_CONFIG_PATH', 'CMAKE_PREFIX_PATH', 'MACOSX_DEPLOYMENT_TARGET']
+  for key in remove:
+    if key in os.environ: del os.environ[key]
+
+@nose.with_setup(cleanup)
 def test_default():
 
   e = EnvironmentWrapper(logging.getLogger())
@@ -32,14 +41,6 @@ def test_default():
     assert key in before, "key `%s' was not on os.environ before" % (key,)
   nose.tools.eq_(before, os.environ)
 
-def cleanup():
-  '''Removes weird variables from the user environment just for the tests'''
-
-  remove = ['CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'BOB_PREFIX_PATH',
-      'PKG_CONFIG_PATH', 'CMAKE_PREFIX_PATH', 'MACOSX_DEPLOYMENT_TARGET']
-  for key in remove:
-    if key in os.environ: del os.environ[key]
-
 @nose.with_setup(cleanup)
 def test_set_debug_true():