Marlin 2.0x no longer builds in OS X

I’ve had zero issues for 2 years and all of a sudden I can’t build Marlin anymore. I spent nearly 5 days straight trying to fix this, hoping someone here can shed some light.

Both Macs are running Catalina 10.15.5


  1. Installed VSCode on another mac
  2. Installed PalformIO IDE
  3. Downloaded Marlin2.0X
  4. Built using the check mark (default build env)

Result: Successful build with 2 warnings

On my main machine:

  1. Uninstalled all home brew or other python installs
  2. Reinstalled Python 3.8.3 and then used App Cleaner to remove it and VS Code
  3. Deleted the hidden files .platformio and .vscode in my home directory
  4. Deleted .zsh profile
  5. Deleted .bash profile (no longer use it but, hey, can’t hurt)
  6. Checked my private frameworks to make sure there were no Python stragglers (there weren’t)
  7. exceuted “Echo $Path” in Terminal to make sure no weird paths were still exported
  8. Rebooted
  9. Downloaded VSCode from Microsoft and installed it
  10. Opened VSCode and installed PlatformIO IDE
  11. Restarted VSCode as instructed by PIO installation
  12. Tried to build Marlin2.0x as downloaded
  13. Failed with these errors:

Fatal Python error: deletion of interned string failed

If I build again I get:

AttributeError: 'WeakSet' object has no attribute 'data':
File "/Users/Michael/.platformio/packages/tool-scons/script/../engine/SCons/Script/", line 1346:
_exec_main(parser, values)
File "/Users/Michael/.platformio/packages/tool-scons/script/../engine/SCons/Script/", line 1309:
File "/Users/Michael/.platformio/packages/tool-scons/script/../engine/SCons/Script/", line 1091:
nodes = _build_targets(fs, options, targets, target_top)
File "/Users/Michael/.platformio/packages/tool-scons/script/../engine/SCons/Script/", line 1283: = jobs_postfunc)
File "/Users/Michael/.platformio/packages/tool-scons/script/../engine/SCons/", line 111:
File "/Users/Michael/.platformio/packages/tool-scons/script/../engine/SCons/", line 381:
task = self.taskmaster.next_task()
File "/Users/Michael/.platformio/packages/tool-scons/script/../engine/SCons/", line 938:
node = self._find_next_ready_node()
File "/Users/Michael/.platformio/packages/tool-scons/script/../engine/SCons/", line 828:
for child in chain(executor.get_all_prerequisites(), children):
File "/Users/Michael/.platformio/penv/lib/python2.7/", line 605:
v = self
<i>File "/Users/Michael/.platformio/packages/tool-scons/script/../engine/SCons/", line 1256:
return UserList.__getitem__(self, i)
File "/Users/Michael/.platformio/penv/lib/python2.7/", line 132:
if subclass is not None and subclass in cls._abc_cache:
File "/Users/Michael/.platformio/penv/lib/python2.7/", line 75:</i>

o_O Why is it referencing Python 2.7 here. PlatformIO has deprecrated Python 2.7 long ago and switched to Python 3.

Some users have reported errors on Python 3.8 and recommended using Python 3.7.X.

You should try tto:

  • remove the PlatformIO tools (remove VSCode extension, remove the <user home>/.platformio folder)
  • try installing known-good Python 3.7 if possible
  • install PlatformIO for the CLI: pip3 install platformio or use the installer script
  • check that pio --version is running properly in the shell
  • download Marlin
  • make appropriate changes to the platformio.ini regarding default environment, user config files, if necessary
  • pio run in the Marlin folder and check if there are errors.

That was my frustration but I did manage to fix last night after nearly 30 hours of hunting and piecing things together. I stayed with Python 3.7.3 because OS X supplies it by defualt, in addition to 2.7 which will supposedly be removed by the system shortly.

I am not sure what is or is not necessary but this is what worked for me:

  1. Go to your home folder and use Command + Shift + Period to unhide hidden files. You can check this post if unsure how
  2. Erase the hidden .platformio folder in your home folder
  3. Open terminal and type in
    sudo pip3 uninstall platformio
    You will probably get a message that it is not installed. The issue is that PIP can no longer install PlatformIO in 10.15.5, and Python 2.7 no longer works with Marlin 2.0X (at least for me)
  4. Use home-brew to install PlatformIO. If you don’t have home-brew you can install it by opening terminal and typing or copy pasting the following text
    /bin/bash -c "$(curl -fsSL"
  5. In terminal type or paste the following to install PlatformIO
    brew install platformio
  6. Open up VSCode and install the python extension from microsoft if you need to switch between Python Versions
  7. When it finishes installing use Command + Shift + P to open the command palette
  8. Type in “Python: select interpreter” and choose Python 3.7.3 for command line tools (both options should work).
  9. Double check you work by opening the .platformio folder in your home holder by double clicking. You should not see anything relating to Python 2.7 or any version for that matter.
  10. In VSCode preferences settings search for platformio-IDE and select the checkbox on Update Terminal Path Configuration (again, may not be needed)
  11. Downlaod latest Marlin an compile as is to test.
  12. If everything worked, go back into settings and look for Python: Python Path. You will probably see python in the field. add a 3 at the end so it reads “python3” to make sure it only uses python3