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:
- Open PyCharm
- Go to Scratches and Consoles in the Project view
- Right-click → New → Scratch File
- 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:
- Right-click on your project root
- New → Scratch File
- Choose Project scratch (not IDE scratch)
These travel with your project and survive upgrades.
Option 2: Sync Settings
Enable JetBrains settings sync:
- File → Manage IDE Settings → Settings Sync
- Sign in with JetBrains account
- 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:
Help → Edit 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:
- Live Templates
- Code Style settings
- Database connections
- Run configurations (unless in .idea)
- Plugins (need reinstalling)
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.