# How to clear cache from IDE?

**URL:** <https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114>\
**Category:** IDE 2.x\
**Created:** [April 16, 2025, 9:18pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114 "2025-04-16T21:18:57Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeHuber](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/joehuber/32/1008872_2.png) [@JoeHuber](https://forum.arduino.cc/u/JoeHuber)\
**Post date:** [April 16, 2025, 9:18pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/1 "2025-04-16T21:18:57Z")

</div>

Is there a way to delete the cache folder from the IDE, or to tell the IDE to not reuse the cached files? (I searched the forum and couldn't find one mentioned)

I've connected the dots to realize if I use the IDE to rename some of my .h or .cpp files then often subsequent compilations will fail as they try to use outdated .o files with the old file names. Restarting the IDE is not sufficient to resolve the problem, but removing the cache folder works every time. That's not quite as simple as it seems because the cache folder is in the hidden Libraries folder on macOS.

So is there a way to tell the IDE to not reuse the cached files or to clear/delete them?

This happens with at least the last several IDE versions including 2.3.6. I'm on macOS 15.3.2

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [April 16, 2025, 9:49pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/2 "2025-04-16T21:49:36Z")

</div>

All you need to do is save the sketch you are working on. I think that bug was fixed in 2.3.6, but I'm not sure.

---

<div class="post-metadata">

**Author:** ![JoeHuber](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/joehuber/32/1008872_2.png) [@JoeHuber](https://forum.arduino.cc/u/JoeHuber)\
**Post date:** [April 16, 2025, 10:18pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/3 "2025-04-16T22:18:04Z")

</div>

I have AutoSave ON and I'm already using IDE 2.3.6.

Are you suggesting doing a manual Save is sufficient or does it need a SaveAs and change the whole sketch name to force a full recompile?

In any case quitting the IDE (which doesn't prompt for unsaved changes) and restarting it does not resolve the problem.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [April 16, 2025, 10:29pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/4 "2025-04-16T22:29:59Z")

</div>

Sounds like a different problem. Are you using any cloud service like Microsoft OneDrive?

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [April 16, 2025, 10:30pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/5 "2025-04-16T22:30:16Z")

</div>

Hi @JoeHuber.

> [@JoeHuber](#):
>
> if I use the IDE to rename some of my .h or .cpp files then often subsequent compilations will fail as they try to use outdated .o files with the old file names.

It sounds like you are encountering this bug:

> <https://github.com/arduino/arduino-cli/issues/1240>
>
> \### Describe the problem
> 
> The previous file persists in the sketch build folder …after a sketch code file with extension other than \`.ino\`/\`.pde\` is renamed.
> 
> 🐛 This can result in spurious compilation errors or confusing bugs. Arduino CLI users can work around the bug by adding the \`--clean\` flag to their command, but the only workaround for Arduino IDE users is to manually clean the build folder.
> 
> \### To reproduce
> 
> \`\`\`text
> $ arduino-cli version
> 
> arduino-cli.exe Version: git-snapshot Commit: a735ddfd Date: 2023-01-15T01:00:07Z
> 
> $ arduino-cli sketch new /tmp/FooSketch
> 
> $ echo "void asdf() {}" \> /tmp/FooSketch/foo.cpp
> 
> $ arduino-cli compile --fqbn arduino:avr:uno /tmp/FooSketch
> 
> \[...\]
> 
> $ mv /tmp/FooSketch/foo.cpp /tmp/FooSketch/bar.cpp
> 
> $ arduino-cli compile --fqbn arduino:avr:uno /tmp/FooSketch
> 
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketch-2405C4C9F90028537C79B0744BCE536E\\sketch\\foo.cpp.o (symbol from plugin): In function \`asdf()':
> (.text+0x0): multiple definition of \`asdf()'
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketch-2405C4C9F90028537C79B0744BCE536E\\sketch\\bar.cpp.o (symbol from plugin):(.text+0x0): first defined here
> collect2.exe: error: ld returned 1 exit status
> 
> Used platform Version Path
> arduino:avr 1.8.6 C:\\Users\\per\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6
> 
> Error during build: exit status 1
> 
> $ ls "C:/Users/per/AppData/Local/Temp/arduino/sketch-2405C4C9F90028537C79B0744BCE536E/sketch"
> 
> bar.cpp bar.cpp.d bar.cpp.o foo.cpp foo.cpp.d foo.cpp.o FooSketch.ino.cpp FooSketch.ino.cpp.d FooSketch.ino.cpp.o
> \`\`\`
> 
> 🐛 \`foo.cpp\` is still present in the build folder even though not present in the sketch. \`foo.cpp\` is compiled in addition to \`bar.cpp\` and the primary sketch file.
> 
> \### Expected behavior
> 
> Files are always removed from the sketch build folder when no longer present in the sketch.
> 
> \### Arduino CLI version
> 
> \#### Original report
> 
> Arduino IDE 1.6.9
> 
> \#### Last verified with
> 
> 0.34.1
> 
> \### Operating system
> 
> \- Linux
> \- Windows
> 
> \### Operating system version
> 
> \- Mint
> \- 10
> 
> \### Additional context
> 
> \#### Workaround
> 
> \<a name="workaround-cli"\>\</a\>
> 
> \##### Arduino CLI users
> 
> Run an \`arduino-cli compile\` command with \[the \`--clean\` flag\](https://arduino.github.io/arduino-cli/dev/commands/arduino-cli\_compile/#options).
> 
> \<a name="workaround-ide"\>\</a\>
> 
> \##### Arduino IDE users
> 
> 1. Examine the compiler error message. It will show the path of the temporary build folder.
> For example, in this error:
> \`\`\`text
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketches\\7930E8409AED6D4F4A4782CF985194E9\\sketch\\foo.cpp.o (symbol from plugin): In function \`asdf()':
> (.text+0x0): multiple definition of \`asdf()'
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketches\\7930E8409AED6D4F4A4782CF985194E9\\sketch\\bar.cpp.o (symbol from plugin):(.text+0x0): first defined here
> collect2.exe: error: ld returned 1 exit status
>    
> exit status 1
>    
> Compilation error: exit status 1
> \`\`\`
> The temporary build folder is:
> \`\`\`text
> C:\\Users\\per\\AppData\\Local\\Temp\\arduino\\sketches\\7930E8409AED6D4F4A4782CF985194E9\\sketch\\
> \`\`\`
> 1. Delete the temporary build folder.
> 
> \#### Additional reports
> 
> \- https://github.com/arduino/arduino-cli/issues/1699
> \- https://github.com/arduino/arduino-cli/issues/2058
> \- https://github.com/arduino/arduino-cli/issues/2613
> \- https://github.com/arduino/arduino-cli/issues/2870
> \- https://github.com/arduino/arduino-ide/issues/970
> \- https://github.com/arduino/arduino-ide/issues/1316
> \- https://github.com/arduino/arduino-ide/issues/1691
> \- https://github.com/arduino/arduino-ide/issues/2323
> \- https://github.com/arduino/arduino-ide/issues/482#issuecomment-2188269824
> \- https://github.com/arduino/Arduino/issues/2072
> \- https://forum.arduino.cc/t/ide-and-compiler-clear/1077526
> \- https://forum.arduino.cc/t/changed-tab-name-in-sketch-still-linking-old-o-file/1046286
> \- https://forum.arduino.cc/t/weird-error-pointing-to-old-code/1113608
> \- https://forum.arduino.cc/t/ide2-bit-upset-need-help/1129513
> \- https://forum.arduino.cc/t/renamed-tabs-wont-go-away/1165338
> \- https://forum.arduino.cc/t/file-renaming-issue/1173234/6
> \- https://forum.arduino.cc/t/reorganizing-code-w-wire-h-library/1180211
> \- https://forum.arduino.cc/t/ide-not-recognising-file-type-change-from-c-to-cpp/1215993
> \- https://forum.arduino.cc/t/code-compiles-in-old-ide-but-not-the-new-one/1286767
> \- https://forum.arduino.cc/t/problem-while-defining-namespaces-with-it-own-cpp-and-hpp-files/1304403
> \- https://forum.arduino.cc/t/there-is-a-bug-in-the-wire-library-for-version-1-8-6-avr-boards/1336297/18
> \- https://forum.arduino.cc/t/new-version-of-arduino-ide-2-3-5-error/1371224/20
> \- https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114
> 
> \---
> 
> \<details\>
> \<summary\>\<b\>Keywords\</b\>\</summary\>
> \<p\>
> 
> \- rename
> \- header
> \- .h
> \- .cpp
> \- .c
> \- C++
> 
> \</p\>
> \</details\>
> 
> \### Issue checklist
> 
> \- \[X\] I searched for previous reports in \[the issue tracker\](https://github.com/arduino/arduino-ide/issues?q=)
> \- \[X\] I verified the problem still occurs when using the latest \[nightly build\](https://www.arduino.cc/en/software#nightly-builds)
> \- \[X\] My report contains all necessary details

> [@JoeHuber](#):
>
> is there a way to tell the IDE to not reuse the cached files or to clear/delete them?

No. You should manually delete the sketch build folder as a workaround for the bug.

It sounds like you already know how to do that, but in case you are having trouble, just let us know and we'll provide instructions.

> [@JoeHuber](#):
>
> That's not quite as simple as it seems because the cache folder is in the hidden Libraries folder on macOS.

If you like, you can configure macOS to always show the `Library` folders:

> <https://apple.stackexchange.com/questions/378377/how-to-permanently-unhide-the-users-library-folder-in-catalina/378378#378378>

Or if you don't normally want to see them, use the **Command** + **Shift** + **.** keyboard shortcut to toggle the visibility.

---

<div class="post-metadata">

**Author:** ![kenb4](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kenb4](https://forum.arduino.cc/u/kenb4)\
**Post date:** [April 17, 2025, 12:32am UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/6 "2025-04-17T00:32:25Z")

</div>

> [@JoeHuber](#):
>
> the cache folder is in the hidden Libraries folder on macOS.

Not for me

```bash
$ find /private/var/folders -name sketches 2> /dev/null
/private/var/folders/rf/_lcbkycs7pld4c0vk5xd53sr0000gn/T/arduino/sketches

```

There's a bunch of "random" folders in there, one for each sketch

```bash
$ ls `find /private/var/folders -name sketches 2> /dev/null`
05E5D45AD298268AAA0E1289BF14EE92	5FD30D51257B44B002F369D1669BFB5C
09DDC5CF5807552D331FA74AD299483C	65EC76FA6DE1D2C4DCFDAED308E36DA1
0C757DD9781FE76541E17D3E7ED7D774	731AE8136766C03FF4877A6BFDDB9162
2118DF32DE8E78472CA613BA8C84EA85	88C15829197E78D9A90CF881EE15FB1A

```

You could erase all of them. To find the one specific to your sketch, turn on "Show verbose output during compile" and the full path is mentioned often.

---

<div class="post-metadata">

**Author:** ![JoeHuber](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/joehuber/32/1008872_2.png) [@JoeHuber](https://forum.arduino.cc/u/JoeHuber)\
**Post date:** [April 17, 2025, 3:21am UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/7 "2025-04-17T03:21:10Z")

</div>

Interesting... here's the path to mine...  
`/Users/joehuber/Library/Caches/arduino/sketches/EF5D6A677F7367EE163D5E3D79923CF2/sketch/src/FileTools.cpp.o`

And when the problem occurs I can remedy it by deleting:  
`/Users/joehuber/Library/Caches/arduino/sketches`

---

<div class="post-metadata">

**Author:** ![JoeHuber](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/joehuber/32/1008872_2.png) [@JoeHuber](https://forum.arduino.cc/u/JoeHuber)\
**Post date:** [April 17, 2025, 3:25am UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/8 "2025-04-17T03:25:31Z")

</div>

> [@ptillisch](#):
>
> It sounds like you are encountering this bug:

Yes, that sounds like the same issue.

Is there a recommended way to rename .h and .cpp files to avoid triggering this bug? I'm going to try quitting the IDE entirely and using the Finder to rename them and then start the IDE again. Fingers crossed...

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [April 17, 2025, 4:25am UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/9 "2025-04-17T04:25:38Z")

</div>

> [@JoeHuber](#):
>
> Is there a recommended way to rename .h and .cpp files to avoid triggering this bug?

The only way you could avoid it would be to also rename the sketch (or otherwise change its path) when you renamed the files, which would cause a new build folder to be used.

---

<div class="post-metadata">

**Author:** ![JoeHuber](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/joehuber/32/1008872_2.png) [@JoeHuber](https://forum.arduino.cc/u/JoeHuber)\
**Post date:** [April 17, 2025, 4:56am UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/10 "2025-04-17T04:56:32Z")

</div>

Per Thanks for the info. I guess I'll just automate deleting the cache folder for those cases where I want to rename files...

Thanks,  
Joe

---

<div class="post-metadata">

**Author:** ![kenb4](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kenb4](https://forum.arduino.cc/u/kenb4)\
**Post date:** [April 17, 2025, 6:57am UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/11 "2025-04-17T06:57:56Z")

</div>

`arduino-cli` [v1.1.0](https://github.com/arduino/arduino-cli/releases/tag/v1.1.0) includes ["Fixed `build_cache.path` behaviour"](https://github.com/arduino/arduino-cli/pull/2673) which moved the path from a temp directory to the platform-specific cache directory, as returned by [`os.UserCacheDir`](https://pkg.go.dev/os#UserCacheDir)

That is first picked up in IDE [v2.3.4](https://github.com/arduino/arduino-ide/releases/tag/2.3.4) which upgraded CLI from v1.0.4 to v1.1.1

I'm still running 2.3.3 on this Mac.

---

<div class="post-metadata">

**Author:** ![reddogluna](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/reddogluna/32/1099233_2.png) [@reddogluna](https://forum.arduino.cc/u/reddogluna)\
**Post date:** [May 18, 2025, 12:42pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/12 "2025-05-18T12:42:45Z")

</div>

I'm have a similar problem. Sounds like the IDE should be modified to included a "Rebuild Solution" like Visual Studio has under the build tab that rebuilds the sketch from scratch.  
How do you get this recommendation into the IDE change queue?

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [May 18, 2025, 2:51pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/13 "2025-05-18T14:51:25Z")

</div>

Hi @reddogluna. It would be silly to add a cache clearing feature to Arduino IDE as a user unfriendly workaround for a bug. The correct use of the limited development resources is to fix the bug.

---

<div class="post-metadata">

**Author:** ![reddogluna](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/reddogluna/32/1099233_2.png) [@reddogluna](https://forum.arduino.cc/u/reddogluna)\
**Post date:** [May 18, 2025, 3:14pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/14 "2025-05-18T15:14:09Z")

</div>

I agree that a bug should be fixed but there maybe conditions that would not be considered a bug that could cause a problem.  
It's interesting Microsoft felt that having a "clean build" vs. just build was worth adding another button.

Again, How do you get this recommendation into the IDE change queue request and let the "team" decide

---

<div class="post-metadata">

**Author:** ![ptillisch](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@ptillisch](https://forum.arduino.cc/u/ptillisch)\
**Post date:** [May 18, 2025, 3:20pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/15 "2025-05-18T15:20:32Z")

</div>

> [@reddogluna](#):
>
> It's interesting Microsoft felt that having a "clean build" vs. just build was worth adding another button.

Microsoft has a lot more resources than the Arduino company.

> [@reddogluna](#):
>
> How do you get this recommendation into the IDE change queue request and let the "team" decide

I am the most senior and active member of the team who maintains the Arduino IDE project. So the team has already decided and you would only waste your time by submitting a formal request.

---

<div class="post-metadata">

**Author:** ![JoeHuber](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/joehuber/32/1008872_2.png) [@JoeHuber](https://forum.arduino.cc/u/JoeHuber)\
**Post date:** [September 30, 2025, 3:32pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/16 "2025-09-30T15:32:47Z")

</div>

FWIW I was bit by this issue/bug once again today. I spent more time than I’d like to admit searching for a solution before google directed me back here to my thread from 6 months ago.

I completely agree that fixing the underlying bug would be the best approach but in the meantime users may fall into a difficult to diagnose trap that leaves their project stranded and uncompilable just by renaming a file.

Maybe it would be worthwhile to provide a workaround until the underlying bug can be fixed.

**Possibilities** :

1. Ideally fix the IDE/compiler to better handle renaming files
2. Add Tools menuitem for full clean recompile (good for hygiene anyway)
3. Or add Tools menuitem to delete cache (like browsers offer)
4. Or add Tools menuitem to at least open (reveal) the cache folder

Having an option for a full clean recompile is a good hygiene feature anyway to have in the long run as a validation that your full project is compilable from scratch with the currently installed set of libraries.

#2 and #3 are relatively easily understood commands even for someone not familiar with the details of this issue and they may be useful to resolve other issues with library versioning etc.

I agree none of these warrant a new button in the IDE as they should be rarely used. But having the capability somewhere in the Tools menu seems like a good UI and useful addition to me.

I’d certainly like to have such a menuitem right about now… 😉

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [March 29, 2026, 3:32pm UTC](https://forum.arduino.cc/t/how-to-clear-cache-from-ide/1374114/17 "2026-03-29T15:32:49Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
