Skip to content
Go back

Restore PyCharm Scratch Files After Upgrading Versions

You upgraded PyCharm. Your scratch files are gone. Here’s how to get them back in 2 minutes.

Table of contents

Open Table of contents

The Problem

PyCharm stores scratch files separately from your projects. When you upgrade to a new major version (like 2025.1 to 2025.2), it creates a new configuration directory. Your old scratches are still there – just in the wrong folder.

Quick Fix: Copy Your Scratch Files

macOS

Find your scratch files in the old version’s folder:

# Old scratches location (replace 2025.1 with your previous version)
~/Library/Application Support/JetBrains/PyCharm2025.1/scratches/

# New location (replace 2025.2 with your current version)
~/Library/Application Support/JetBrains/PyCharm2025.2/scratches/

Copy them over:

cp -r ~/Library/Application\ Support/JetBrains/PyCharm2025.1/scratches/* \
     ~/Library/Application\ Support/JetBrains/PyCharm2025.2/scratches/

Windows

# Old scratches
%APPDATA%\JetBrains\PyCharm2025.1\scratches\

# Copy to new location
xcopy "%APPDATA%\JetBrains\PyCharm2025.1\scratches\*" ^
      "%APPDATA%\JetBrains\PyCharm2025.2\scratches\" /E /I

Linux

# Old scratches
~/.config/JetBrains/PyCharm2025.1/scratches/

# Copy to new
cp -r ~/.config/JetBrains/PyCharm2025.1/scratches/* \
     ~/.config/JetBrains/PyCharm2025.2/scratches/

Make Them Appear in PyCharm

Here’s the weird part: After copying, your scratches won’t show up immediately in the Scratches view.

The trick:

  1. Open PyCharm
  2. Go to Scratches and Consoles in the Project view
  3. Right-click → NewScratch File
  4. Cancel the dialog

Boom. All your old scratches appear at once.

Why This Works

PyCharm indexes scratch files lazily. Creating a new scratch triggers a refresh of the scratches directory. Your copied files get discovered and indexed all at once.

Prevent Future Loss

Option 1: Use Project Scratches

Store important scratches in your project instead of globally:

  1. Right-click on your project root
  2. NewScratch File
  3. Choose Project scratch (not IDE scratch)

These travel with your project and survive upgrades.

Option 2: Sync Settings

Enable JetBrains settings sync:

  1. FileManage IDE SettingsSettings Sync
  2. Sign in with JetBrains account
  3. Enable sync

Your scratches sync across machines and versions.

Option 3: Git Your Scratches

For critical scratch files, version control them:

cd ~/Library/Application\ Support/JetBrains/PyCharm2025.2/scratches
git init
git add .
git commit -m "Backup scratches"

Find Your Config Directory

Not sure where PyCharm stores config? Open PyCharm and check:

HelpEdit Custom Properties → Look at the file path

The scratches folder is in the same parent directory.

What Else Gets Lost?

When upgrading PyCharm versions, these also don’t transfer automatically:

The same copy technique works for most of these – they’re all in the JetBrains config folder.

The 30-Second Version

# macOS one-liner (adjust versions)
cp -r ~/Library/Application\ Support/JetBrains/PyCharm2025.1/scratches/* ~/Library/Application\ Support/JetBrains/PyCharm2025.2/scratches/ && echo "Done. Now create a new scratch in PyCharm to see them all."

That’s it. Your scratch files are back. No more rewriting that complex regex or SQL query you perfected last month.


Share this post on:

Previous Post
I Run 4 AI Agents in Parallel. Here's How I Keep Them from Destroying My Codebase
Next Post
Django + Next.js SaaS Starter Template with AI Agents