Mac升级至10.13.4后运行tkeclipse/tktools出现Objective-C垃圾回收报错
This error happens because macOS High Sierra (10.13+) dropped support for Objective-C garbage collection, but the bundled Wish 8.5 binary in your tkeclipse/tktools setup still relies on this deprecated feature. Here are practical solutions to resolve it:
Solution 1: Patch the Wish startup script to disable GC
The fastest workaround is to force-disable garbage collection for the Wish binary using an environment variable. Here's how:
- Locate the
wish8.5script from your error log:/.../Eclipse/tcltk/x86_64_macosx/bin/wish8.5 - Open it in a text editor (like
nanoor TextEdit) - Modify the final line of the script from:
To:"$(dirname $0)/../Library/Frameworks/Tk.framework/Versions/8.5/Resources/Wish.app/Contents/MacOS/Wish" "$@"OBJC_DISABLE_GC=YES "$(dirname $0)/../Library/Frameworks/Tk.framework/Versions/8.5/Resources/Wish.app/Contents/MacOS/Wish" "$@" - Save the file and try running tkeclipse/tktools again. This flag tells the binary to skip GC initialization, which usually fixes the abort trap.
Solution 2: Replace the bundled Tk with a GC-free version
If the first fix doesn't work, swap the outdated Tk framework with a version that doesn't depend on garbage collection:
- Option A: Use Homebrew to install a modern Tk
- Install Homebrew if you haven't already, then run:
brew install tk - Locate the new Wish.app path (typically something like
/usr/local/Cellar/tk/8.6.x/Frameworks/Tk.framework/Versions/8.6/Resources/Wish.app) - Update the
wish8.5script to point to this new path instead of the bundled one.
- Install Homebrew if you haven't already, then run:
- Option B: Compile Tk 8.5 without GC support
- Download the Tk 8.5 source code from the official Tcl/Tk project
- Compile it with the
--disable-gcflag:./configure --with-tcl=/path/to/your/tcl/source --enable-aqua --disable-gc make && make install - Replace the bundled
Tk.frameworkin your Eclipse/tcltk directory with the newly compiled version.
Solution 3: Check for tool updates
If the tool has an official update, it might already include a patched Tk binary compatible with High Sierra. Check the developer's release notes or download page for a version built for macOS 10.13+.
Always back up the original files before making modifications, so you can revert if something goes wrong.
内容的提问来源于stack exchange,提问作者Bird

