By default, pip installs a compiled version of black appropriate for the current architecture. On an ARM Macbook, that ends up with an error message like this:
File "/Users/stephen/Library/Python/3.12/bin//black", line 5, in <module>
from black import patched_main
ImportError: dlopen(/Users/stephen/Library/Python/3.12/lib/python/site-packages/black/__init__.cpython-312-darwin.so, 0x0002): tried: '/Users/stephen/Library/Python/3.12/lib/python/site-packages/black/__init__.cpython-312-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/stephen/Library/Python/3.12/lib/python/site-packages/black/__init__.cpython-312-darwin.so' (no such file), '/Users/stephen/Library/Python/3.12/lib/python/site-packages/black/__init__.cpython-312-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
The main problem being that we're using the ancient ruby18 bundled with Textmate, which is x86 only. If we allow Python FMT to use system ruby instead, this happens:
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Users/stephen/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/osx/plist.bundle, 0x0009): tried: '/Users/stephen/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/osx/plist.bundle' (fat file, but missing compatible architecture (have 'unknown,i386,x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/stephen/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/osx/plist.bundle' (no such file), '/Users/stephen/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/osx/plist.bundle' (fat file, but missing compatible architecture (have 'unknown,i386,x86_64', need 'arm64')) - /Users/stephen/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/osx/plist.bundle (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/stephen/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/lib/textmate.rb:5:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/stephen/Library/Application Support/TextMate/Bundles/Python-FMT.tmbundle/Support/python_helper.rb:4:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from Document Will Save:3:in `<main>'
The problem here is that the provided Bundle Support.tmbundle/Support/shared/lib/textmate.rb
imports Bundle Support.tmbundle/Support/shared/lib/osx/plist.bundle
, which is a compiled ruby extension, distributed by Textmate as a binary for x86_64, i386, and ppc_7400 (!).
Possible solutions to this:
shared/lib/textmate.rb
which comments out the plist import (possibly breaking any plist-parsing ruby-based bundles that happily run in ruby18 with x86-mode?)TextMate::Process.run()
entirely. In this case, maybe textmate2-python-fmt
could package a version of the necessary functions which avoids importing plist.bundlePay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too