Skip to content

libexpat now an explicit install requirement on macOS #1560

Description

@damienbutt

Hi,

It seems in recent updates to macOS, the OS no longer provides libexpat which thefuck seems to depend on causing the following errors.

Last login: Thu Mar 19 15:26:31 on ttys000
Traceback (most recent call last):
  File "/usr/local/bin/thefuck", line 9, in <module>
    from thefuck.entrypoints.main import main
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/entrypoints/main.py", line 2, in <module>
    from ..system import init_output
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/system/__init__.py", line 7, in <module>
    from .unix import *  # noqa: F401,F403
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/system/unix.py", line 6, in <module>
    from distutils.spawn import find_executable
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 92, in create_module
    return importlib.import_module('setuptools._distutils')
  File "/usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/setuptools/__init__.py", line 16, in <module>
    import setuptools.version
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/pkg_resources/__init__.py", line 32, in <module>
    import plistlib
  File "/usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/plistlib.py", line 70, in <module>
    from xml.parsers.expat import ParserCreate
  File "/usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: dlopen(/usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/pyexpat.cpython-310-darwin.so, 0x0002): Library not loaded: /usr/local/opt/expat/lib/libexpat.1.dylib
  Referenced from: <5ACBBCC9-850E-3F9A-8618-4ECD23D815FF> /usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/pyexpat.cpython-310-darwin.so
  Reason: tried: '/usr/local/opt/expat/lib/libexpat.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/expat/lib/libexpat.1.dylib' (no such file), '/usr/local/opt/expat/lib/libexpat.1.dylib' (no such file)

~
❯ fuck --help
Traceback (most recent call last):
  File "/usr/local/bin/fuck", line 9, in <module>
    from thefuck.entrypoints.not_configured import main
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/entrypoints/not_configured.py", line 2, in <module>
    from ..system import init_output
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/system/__init__.py", line 7, in <module>
    from .unix import *  # noqa: F401,F403
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/thefuck/system/unix.py", line 6, in <module>
    from distutils.spawn import find_executable
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/_distutils_hack/__init__.py", line 92, in create_module
    return importlib.import_module('setuptools._distutils')
  File "/usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/setuptools/__init__.py", line 16, in <module>
    import setuptools.version
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/usr/local/Cellar/thefuck/3.32/libexec/lib/python3.10/site-packages/pkg_resources/__init__.py", line 32, in <module>
    import plistlib
  File "/usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/plistlib.py", line 70, in <module>
    from xml.parsers.expat import ParserCreate
  File "/usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: dlopen(/usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/pyexpat.cpython-310-darwin.so, 0x0002): Library not loaded: /usr/local/opt/expat/lib/libexpat.1.dylib
  Referenced from: <5ACBBCC9-850E-3F9A-8618-4ECD23D815FF> /usr/local/Cellar/python@3.10/3.10.20/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/pyexpat.cpython-310-darwin.so
  Reason: tried: '/usr/local/opt/expat/lib/libexpat.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/expat/lib/libexpat.1.dylib' (no such file), '/usr/local/opt/expat/lib/libexpat.1.dylib' (no such file)

The fix is to install libexpat with Homebrew explicitly using:

brew install expat

Then everything is good again.

Thanks,
D

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions