OK; here's an attempt at a tutorial for a fix...
So far, it seems to compile an empty sketch for "many" of the ESP32 boards (including the Arduino Nano ESP32.)
Let me know if there are parts that are particularly unclear, or if you run into additional problems...
Using ESP32 Arduino in older MacOS
Problem Statment:
Recent ESP32 board packages fail to work on older versions of MacOSX (ie "High Sierra 10.13.x) It yields error messages like:
"Error loading Python library '/var/folders/..../libpython3.8.dylib'"
Analysis:
With verbose logging on (from Preferences), we see more details
... /Applications/Arduino...packages/esp32/tools/esptool_py/4.6\/esptool --chip esp32s3 elf2image ...
[64191] Error loading Python lib '/var/folders/gv/zn3wcml52jq0vvjnd95j8g6h0000gp/T/_MEIGDe0by/libpython3.8.dylib': ... : Library not loaded: @loader_path/libintl.8.dylib
Reason: Incompatible library version: libpython3.8.dylib requires version 12.0.0 or later, but libintl.8.dylib provides version 11.0.0
Hypothesis:
"esptool" has been created as a "packaged" python script, including its own copy of a python interpreter (say, using "pyinstaller".)
Unfortunately, this was done using a version of Python that does not run on older versions of MacOSX (Apple made some changes in weird places, I think for "security purposes. Older MacOS doesn't support OS calls used by these changes, so programs compiled with "new" MacOS that use those system calls don't work on older MacOS.)
esptool is a simple CLI program, and ought not be dependent on OS version. All we should need to do is replace esptool with a version that doesn't have the new OS dependencies.
Procedure:
A certain familiarity with using the MacOS "Terminal" program will be helpful.
Installing Python3.
First, we must make sure that Python3 is installed on the Mac. Older MacOS includes Python2.7, which (almost certainly) won't work.
Open the Utilities/Terminal application, and type "python3" at the prompt. If it works, type Ctrl-D to exit.
If it doesn't work, Python3 can be downloaded from Python Releases for macOS | Python.org
Use the Python 3.12.4 MacOS 64bit universal installer, and run it after downloading. After this, typing "python3" in the terminal window should work. (This should install python3 without having to install the (very large) XTools package, which some instructions suggest.)
Installing ESPTOOL.
In the terminal window, type "pip3 install esptool"
And then "which esptool.py" to find out where it is.
> which esptool.py
/usr/local/bin/esptool.py
Connect to the esp32 board package (which you should have already installed, using the Arduino IDE.)
> cd /Users/xxxx/Library/Arduino15/packages/esp32
Use the "find" command to find all the instances of esptool:
> find . -name esptool
./esptool_py/4.5.1/esptool
./esptool_py/3.1.0/esptool
./esptool_py/2.6.1/esptool
Back these up, just in case:
> mv ./esptool_py/4.5.1/esptool ./esptool_py/4.5.1/esptool.old
> mv ./esptool_py/3.1.0/esptool ./esptool_py/3.1.0/esptool.old
> mv ./esptool_py/2.6.1/esptool ./esptool_py/2.6.1/esptool.old
For each of those, link them to the newly installed esptool.py
> ln -s /Library/Frameworks/Python.framework/Versions/3.12/bin/esptool.py ./esptool_py/4.5.1/esptool
> ln -s /Library/Frameworks/Python.framework/Versions/3.12/bin/esptool.py ./esptool_py/3.1.0/esptool
> ln -s /Library/Frameworks/Python.framework/Versions/3.12/bin/esptool.py ./esptool_py/2.6.1/esptool
(I don't know why there are so many. This MIGHT mean that some esp32 boards will work, and others won't.)
At this point, Arduino build of ESP32 builds should get further.
But there are NEW errors, complaining about "python3 not found in path" when trying to run gen_esp32part.py.
Python Not in PATH.
I don't know what the Arduino is using for a PATH that it can't find python3, but to fix this, it seems easiest to simply provide a more specific path.
python SHOULD be accessible via /usr/local/bin/python3. Check to make sure by typing "/usr/local/bin/python3" in the terminal window. If this doesn't work, even though just typing "python3" DOES work, you'll want to install a symbolic link:
Figure out where python3 actually lives with the "which python3" terminal command:
> which python3
/Volumes/MacOS/HD-Users/BillW/opt/anaconda3/bin/python3
Then do:
sudo ln -s /Volumes/MacOS/HD-Users/BillW/opt/anaconda3/bin/python3 /usr/local/bin/python3
(where the first argument is the results of the "which" command.)
Now, navigate to the location of your "platforms." Probably ...username/Library/Arduino15/packages/ (You may have to take steps to get to "Library" , since it's normally Hidden.") We need to edit the esp32 platform file (probably ...packages/esp32/hardware/esp32/3.0.2/platform.txt and ...packages/arduino/esp32/2.0.13/platform.txt) using a plain text editor (textedit will work.)
Just change all the occurances of "python3" to "/usr/local/bin/python3" (probably not all of them need to be changed - some are for linux - but it won't hurt anything...)
And that should do it.