ESP32 / Big Sur Mac OS compilation fail

It looks like the esptool is a compiled version, not the Python one. I did the following:

copy /Users/XXXXX/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/tools/esptool.py
to /Users/XXXXX/Library/Arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py

chmod +x esptool.py

edit the file /Users/XXXXX/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/platform.txt
and change the following line:
tools.esptool_py.cmd=esptool into:
tools.esptool_py.cmd=esptool.py

save platform.txt, restart ArduinoIDE