diff --git a/cache.py b/cache.py
index 4ba9122c44e8ca98ef1a5b1103bacd7bb291e512..4732fa39d6bec1ea323174be446177c82c3ea403 100644
--- a/cache.py
+++ b/cache.py
@@ -8,7 +8,8 @@ except ImportError:
 
 try:
     from joblib import Memory
-    diskcache = Memory(cachedir="/tmp/pystencils/joblib_memcache", verbose=False).cache
+    from appdirs import user_cache_dir
+    diskcache = Memory(cachedir=user_cache_dir('pystencils'), verbose=False).cache
 except ImportError:
     # fallback to in-memory caching if joblib is not available
     diskcache = memorycache(maxsize=64)
diff --git a/cpu/cpujit.py b/cpu/cpujit.py
index 3e1db4520bce529a5022d2b1460cf16c835de4f5..37229a9769704f7afe0d0fcec02daa11380e2032 100644
--- a/cpu/cpujit.py
+++ b/cpu/cpujit.py
@@ -69,6 +69,7 @@ import platform
 import glob
 import atexit
 import shutil
+from appdirs import user_config_dir, user_cache_dir
 from ctypes import cdll
 from pystencils.backends.cbackend import generateC, getHeaders
 from collections import OrderedDict, Mapping
@@ -142,10 +143,7 @@ def _recursiveDictUpdate(d, u):
 
 
 def getConfigurationFilePath():
-    if platform.system().lower() == 'linux':
-        configPathInHome = os.path.expanduser(os.path.join("~", '.config', 'pystencils', 'config.json'))
-    else:
-        configPathInHome = os.path.expanduser(os.path.join("~", '.pystencils', 'config.json'))
+    configPathInHome = os.path.join(user_config_dir('pystencils'), 'config.json')
 
     # 1) Read path from environment variable if found
     if 'PYSTENCILS_CONFIG' in os.environ:
@@ -177,12 +175,7 @@ def readConfig():
             ('flags', '-Ofast -DNDEBUG -fPIC -march=native -fopenmp -std=c++11'),
             ('restrictQualifier', '__restrict__')
         ])
-        defaultCacheConfig = OrderedDict([
-            ('readFromSharedLibrary', False),
-            ('objectCache', '/tmp/pystencils/objectcache'),
-            ('clearCacheOnStart', False),
-            ('sharedLibrary', '/tmp/pystencils/cache.so'),
-        ])
+
     elif platform.system().lower() == 'windows':
         defaultCompilerConfig = OrderedDict([
             ('os', 'windows'),
@@ -191,12 +184,12 @@ def readConfig():
             ('flags', '/Ox /fp:fast /openmp /arch:avx'),
             ('restrictQualifier', '__restrict')
         ])
-        defaultCacheConfig = OrderedDict([
-            ('readFromSharedLibrary', False),
-            ('objectCache', os.path.join('~', '.pystencils', 'objectcache')),
-            ('clearCacheOnStart', False),
-            ('sharedLibrary', os.path.join('~', '.pystencils', 'cache.dll')),
-        ])
+    defaultCacheConfig = OrderedDict([
+        ('readFromSharedLibrary', False),
+        ('objectCache', os.path.join(user_cache_dir('pystencils'), 'objectcache')),
+        ('clearCacheOnStart', False),
+        ('sharedLibrary', os.path.join(user_cache_dir('pystencils'), 'cache.so')),
+    ])
 
     defaultConfig = OrderedDict([('compiler', defaultCompilerConfig),
                                  ('cache', defaultCacheConfig)])