Skip to content

OSError: cannot load library 'libgobject-2.0-0' on macOS (Apple Silicon) #4

@moliholy

Description

@moliholy

OSError: cannot load library 'libgobject-2.0-0' on macOS (Apple Silicon)

Describe the bug
When running make run or make assets-plugin on macOS with Apple Silicon (M1/M2/M3), the application fails to start with an OSError: cannot load library 'libgobject-2.0-0'. This occurs even if the required system libraries (glib, cairo, pango) are installed via Homebrew.

To Reproduce
Steps to reproduce the behavior:

  1. Install system dependencies: brew install cairo pango gdk-pixbuf libffi
  2. Run the development server: make run
  3. See error in terminal:
OSError: cannot load library 'libgobject-2.0-0': dlopen(libgobject-2.0-0, 0x0002): tried: 'libgobject-2.0-0' (no such file), ...

Expected behavior
The Indico development server should start successfully and locate the Homebrew-installed libraries automatically.

Additional context
The issue is caused by WeasyPrint (used in indico.modules.receipts) failing to find libgobject because Homebrew on Apple Silicon installs libraries in /opt/homebrew/lib, which is not in the default search path for the Python interpreter or cffi.

Proposed Fix
The Makefile was updated to explicitly include the Homebrew library path for the run target:

run:
	DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib uv run indico run --quiet --enable-evalex

The logic could be fancier so that it detects whether the OS is MacOS.

I also tried to work around this by adding the following to .envrc (if using direnv) and/or shell profile:

export DYLD_FALLBACK_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_FALLBACK_LIBRARY_PATH"

However, this last approach did not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions