Gaphor on macOS#

The latest release of Gaphor can be downloaded from the Gaphor download page. Gaphor can also be installed as a Homebrew cask.

Older releases are available from GitHub.

CI builds are also available.

Development Environment#

To set up a development environment with macOS:

  1. Install Homebrew

  2. Open a terminal and execute:

brew install python3 gobject-introspection gtk4 gtksourceview5 libadwaita adwaita-icon-theme graphviz

Install Poetry using pipx:

pipx install poetry

Next, clone the repository, after which you can execute the following consecutive commands to install the poetry environment:

cd gaphor
poetry install
poetry run pre-commit install

Now, you can run gaphor as

poetry run gaphor

If PyGObject does not compile and complains about a missing ffi.h file, set the following environment variable and run poetry install again:

export PKG_CONFIG_PATH=/opt/homebrew/opt/libffi/lib/pkgconfig  # use /usr/local/ for older Homebrew installs
poetry install

Debugging using Visual Studio Code#

Before you start debugging you’ll need to open Gaphor in VSCode (the folder containing pyproject.toml). You’ll need to have the Python extension installed.

Create a file .vscode/launch.json with the following content:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Gaphor UI",
            "type": "python",
            "request": "launch",
            "module": "gaphor",
            "justMyCode": false
        }
    ]
}

Packaging for macOS#

In order to create an exe installation package for macOS, we utilize PyInstaller which analyzes Gaphor to find all the dependencies and bundle them in to a single folder.

  1. Follow the instructions for settings up a development environment above

  2. Open a terminal and execute the following from the repository directory:

poetry run python po/build-babel.py
poetry install --with packaging
poetry run poe package