diff --git a/lib/GHCup.hs b/lib/GHCup.hs
index 591f3443d16b39d553b1614fba7659e541f08090..5a226e88b0aa2978014210ca4edf6720a9cf133a 100644
--- a/lib/GHCup.hs
+++ b/lib/GHCup.hs
@@ -1542,8 +1542,11 @@ rmGhcupDirs = do
 
   handleRm $ rmEnvFile  envFilePath
   handleRm $ rmConfFile confFilePath
-  handleRm $ rmDir cacheDir
+  
+  -- for xdg dirs, the order matters here
   handleRm $ rmDir logsDir
+  handleRm $ rmDir cacheDir
+
   handleRm $ rmBinDir binDir
   handleRm $ rmDir recycleDir
 #if defined(IS_WINDOWS)