Suddenly getting "command not found: platformio" when using "Auto Build Marlin" plugin

Bear with me as I info-dump - I haven’t got a clue what might or might not be relevant, as I only use VSCode/PlatformIO intermittently, for the single purpose of fiddling with the Marlin firmware for my 3-D printer.

I’m doing this on a Mac running Catalina (Newest MacOS version that will install on this machine without hacking)

Initially, I followed the combined advice of several YouTube videos - Download and install VSCode, hit the marketplace and get the PlatformIO and Auto Build Marlin packages, download/clone the Marlin repository, use VSCode to do the required edits on the Marlin configuration.h/configuration_adv.h files, bring up the ABM plugin and hit the button for my build, copy the resulting *.bin file to an SD card and flash it to the printer, lather, rinse, repeat as needed. This worked just fine across several upgrades to the printer and/or updates to Marlin itself that needed a new compile to bring online, and eventually, I got things to where I wanted them. Once I got things dialed in, I had no further immediate need for VSCode and associated stuff, including PlatformIO, so it sat idle, untouched, doing nothing but claiming a few megabytes of disk space. Ready - or so I thought - to spring into action the next time I need to change something in the firmware. So far as I’m aware, nothing about the setup changed - or was even looked at - everything just sat there for the few months that passed when I didn’t need to actually use it.

TL/DNR: I HAD a setup of VSCode/PlatformIO/Auto Build Marlin that WAS working perfectly fine, repeatedly doing exactly as expected. Now I don’t, for no reason that can figure out.

Fast forward to last weekend, when I did some hardware tinkering on the printer that required firmware changes - No problem! Just whip out the ready-to-go VSCode installation and setup, hit the “build” button in ABM, and away we go!

Except that instead of hitting the build button on the Auto Build Marlin screen and getting a terminal pane scrolling the various source code filenames as the compile proceeds, and eventually a fresh-built “firmware-.bin” file I can put on the SD card to flash the printer, I keep getting what follows in the terminal pane that opens up after the button is hit:

platformio run -e STM32F103RE_creality ; echo "done" "/var/folders/hp/hp0wkzzx5p52jmdl3mj93kbh0000gn/T/ipc"
MyUserID@MyMachine Marlin-2.1.2 % platformio run -e STM32F103RE_creality ; echo "done" >|"/var/folders/hp/hp0wkzzx5p52jmdl3mj93kbh0000gn/T/ipc"
zsh: command not found: platformio
MyUserID@MyMachine Marlin-2.1.2 % 

After driving myself crazy for several days trying to figure out and fix what might be wrong, (Need I mention that I had no success?) I gave up - uninstalled/deleted everything to do with VSCode, PlatformIO, Auto Build Marlin, and everything else that seemed to make even a speck of sense, and started over - intending it to be a right from scratch clean start. (Yes, I got the .vscode, .platformio and .cache directories, along with the preferences and everything else associated - or at least, I THOUGHT I got everything…)

Downloaded a spankin’ fresh copy of VSCode for Mac, un-crated it, and fired it up.

It comes up as though I never quit the program! (Even though I had to quit it before the OS would let me delete the file!) The cursor is sitting there at the end of the last change I made to the configuration.h file! OK, something’s fishy, but let’s keep moving - Go to the marketplace, get/install PlatformIO IDE (and apparently various dependencies), ditto for Auto Build Marlin, then in an abundance of caution, quit VSCode, and restart it. Again, it comes up with my project open. Still smells fishy to me, but let’s see what happens. Bring up ABM’s screen. Hit the “make-it-happen” button of the right build variant, and get:

platformio run -e STM32F103RE_creality ; echo "done" >|"/var/folders/hp/hp0wkzzx5p52jmdl3mj93kbh0000gn/T/ipc"
MyUserID@MyMachine Marlin-2.1.2 % platformio run -e STM32F103RE_creality ; echo "done" >|"/var/folders/hp/hp0wkzzx5p52jmdl3mj93kbh0000gn/T/ipc"
zsh: command not found: platformio
MyUserID@MyMachine Marlin-2.1.2 %

Seems to indicate that there are some “App turds” left after a “get rid of VSCode and friends” operation… Chase several of those down and wipe 'em out, try the reinstall process again. Get the same result. (The text I’ve already pasted twice, and no new firmware-*.bin file like I used to get when I did exactly the same thing.)

OK, since I can’t seem to clean out all traces of VSCode - The new install picked up as though I’d never quit the program, let alone deleted it - I’ll go another route - Create a new user account, log in to it, download fresh copies of everything involved, and try from that account. Presto! Success! Works just as well as it did back when I first started upgrading my printer!

OK, at least I can flash my printer with the new firmware it needs, but what’s going wrong that forces me to jump through these insane hoops to manage to do it? And more important, how do I fix it so I don’t need to jump through the hoops in the first place? This seems to me a lot like spending years to customize your car, getting it to the point of “just the way I like it”, but after the first few drives, the tires fall off, so you have to rent a rusted-out Yugo to get around.

Any help for the kid?

Well, I’m afraid I have no idea! Given this is on a Mac. I’m Linux.

However, options?

  • Does your nonworking username, MyUserID, have spaces, illegal characters etc?

  • Has your PATH variable been set correctly? On Linux it needs $HOME/.platformio/penv/bin to get the commands working in a Terminal session. Maybe some other program overwrote PATH?

  • In VSCode, are you using Terminal->New Terminal or clicking the icon. Actually is Auto Marlin perhaps opening a default new terminal rather than a PlatformIO new terminal? They are different.




Please note that at one point, everything was perfectly fine, and did exactly what was expected many times. This problem surfaced after the whole thing - tools, data, source code, settings and all - had been left untouched for a few months after the last successful use for a firmware update on the printer, and while it’s possible that during that time, something got moved, overridden, overwritten, or deleted as part of doing “other stuff”, it’s not something I intentionally/knowingly did.

PATH variable where? In a shell? or within VSCode? or someplace in PlatformIO? If either or both of the latter two options, I’ll need some hand-holding to answer you. If in a shell, I’ll take a look - And it turns out there was no such PATH entry. I’ve added “~/.PlatformIO/penv/bin” to the “export PATH=…” line of my ~/.profile. Let’s see if that makes any difference…

Didn’t seem to do anything useful until I quit out of VSCode and restarted it (guess that should hardly be surprising) but once I did that, it’s looking like it fixed the problem - no complaints about platformio not being found when I hit the “make it happen” button in Auto Build Marlin like I’ve been seeing - I’m currently waiting for it to finish downloading/installing dependencies before it actually starts compiling, but it sure looks like this may have cured the problem.

And sure enough - Fiddling with my path did it. Once the dependencies finished downloading/installing, it eventually took off, and while it gave me a couple compile errors due to typos (totally on me) in my configuration.h file, it did what was expected. How the devil did I manage to miss such a screamingly obvious solution??? A classic case of not being able to see the forest for all the freakin’ trees in the way, I guess…


Sorry, my bad! That should have been $HOME/.platformio/penv/bin with platformio in lower case. I appear to have been auto-corrupted! It’s my phone, when I type “platformio” it converts it to “PlatformIO”. Sorry. :frowning_face:

However, I’m glad we got you sorted. Whenever something works, then after a while untouched, stops working, the solution is usually somewhere else.


Actually, looking back after not noticing anything, I think that may be some sort of an artifact of the board - I have “platformio” (all lowercase) in my PATH, just like your original post shows, but where I pasted it from my PATH into my response to you, and the part of your first message I quoted, as well as you quoting what I posted back to me in the message I’m responding to, I now see that it appears to have been converted to “PlatformIO” (with a capital P, I, and O). I wonder if this message is gonna get its capitalization “massaged” for me, too? I’ll see in a moment, I guess.

Meanwhile, I’ve gotten the typos that caused the compile errors in the earlier message fixed, punched for a compile, got the expected “firmware-(insert compile date and time here).bin” file, flashed it to the printer, and the printer is now noticing and reacting correctly when I cut the filament in the middle of a test print to see if the new filament runout sensor I installed last weekend works. In other words, things are working exactly as they should be. Yay!

Thanks again! Been pounding my head against this “missing platformio” problem since hanging the new sensor on the machine, and it was getting to be seriously old and tiresome!

1 Like