       ;; the live modification checker, but which haven't been rebuilt
       ;; yet (which would have removed them from the list).
       (dolist (local-repo straight--live-modified-repos)
-        (print local-repo (current-buffer))))))
+        (print local-repo (current-buffer))))
+    (unless (and straight--build-cache-text
+                 (string= (buffer-string) straight--build-cache-text))
+      (write-region nil nil (straight--build-cache-file) nil 0))))
 
 ;;;;; Live modification checking
 

  ;; malformed (or outdated), these values will be use.
  (setq straight--build-cache (make-hash-table :test #'equal))
  (setq straight--eagerly-checked-packages nil)
  (ignore-errors
    (with-temp-buffer
      ;; Using `insert-file-contents-literally' avoids

        (ignore-errors
          (while t
            (push (read (current-buffer)) live-repos)))
        ;; Make sure to get the list in the correct order, so that we
        ;; can write it back in the same order. (This allows an
        ;; optimization where we don't actually write the build cache
        ;; if it's character-for-character identical.)
        (setq live-repos (nreverse live-repos))
        ;; We might end up in a situation where multiple Emacs
        ;; sessions push the same package to build-cache.el, so we'll
        ;; get rid of those for the sake of cleanliness.
