From 2efd68d22ef2d878c06b439718b26958cad70e7d Mon Sep 17 00:00:00 2001 From: Max Gaukler Date: Sat, 31 May 2025 11:33:07 +0200 Subject: [PATCH] Move "Compiling on MacOSX" documentation from Wiki to Git Move the contents from the Wiki page https://wiki.inkscape.org/wiki/CompilingMacOsX to Git. Short-lived or outdated contents were not moved. --- doc/building/mac.md | 129 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 2 deletions(-) diff --git a/doc/building/mac.md b/doc/building/mac.md index 4cae93105a..d5a91147a3 100644 --- a/doc/building/mac.md +++ b/doc/building/mac.md @@ -2,13 +2,138 @@ # Compiling Inkscape on MacOS -For building on Mac, please click [here](https://wiki.inkscape.org/wiki/index.php?title=CompilingMacOsX) +Inkscape on MacOS can be built with either Homebrew or MacPorts. +## Using Homebrew + +### Dependencies + +Prerequisites: + +- Xcode (AppStore) +- Xcode command line tools (`xcode-select --install`) +- [HomeBrew](https://brew.sh/) + +Make sure you don't have any MacPorts stuff in your PATH. + +Install packages: +``` +brew install \ + adwaita-icon-theme \ + bdw-gc \ + boost \ + cairomm \ + ccache \ + cmake \ + double-conversion \ + gettext \ + gsl \ + gspell \ + gtkmm4 \ + gtksourceview5 \ + imagemagick \ + intltool \ + lcms2 \ + libomp \ + libsoup@2 \ + libxslt \ + ninja \ + pkg-config \ + poppler \ + potrace +``` + +You may substitute `imagemagick` with `graphicsmagick`. + +If you want to include a spell checker, also install `libspelling` using `brew`. + +To build version 1.4.x you need `gtkmm3` instead of `gtkmm4`. + +### Get Inkscape Source +Check out the source if you haven't already: + +``` +git clone --recurse-submodules https://gitlab.com/inkscape/inkscape.git +cd inkscape +``` + +### Build Inkscape + +Inside the Inkscape directory, run the following commands + +``` +# use a clean Homebrew environment (optional) +LIBPREFIX="/opt/homebrew" +export PATH="$LIBPREFIX/bin:/usr/bin:/bin:/usr/sbin:/sbin" + +# Some keg-only libraries need to be added to PKG_CONFIG_PATH +export PKG_CONFIG_PATH="$LIBPREFIX/opt/icu4c/lib/pkgconfig" +export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$LIBPREFIX/opt/libsoup@2/lib/pkgconfig" + +# prevent picking up libxslt and libxml2 from the (wrong) SDK +export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$LIBPREFIX/opt/libxslt/lib/pkgconfig" +export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$LIBPREFIX/opt/libxml2/lib/pkgconfig" + +# where to install +PREFIX="$PWD/install-prefix" + +mkdir -p build +cd build + +cmake \ + -G Ninja \ + -DCMAKE_SHARED_LINKER_FLAGS="-L$LIBPREFIX/lib" \ + -DCMAKE_EXE_LINKER_FLAGS="-L$LIBPREFIX/lib" \ + -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DWITH_DBUS=OFF \ + .. + +ninja +ninja install + +# Start Inkscape +$PREFIX/bin/inkscape +``` + + + +## Using MacPorts + +We currently have no working instructions for MacPorts. Feel free to provide instructions. + + +## Packaging + +If `$PREFIX/bin/inkscape` works when executed and you want to turn it into an app or a DMG, you can use the [mibap](https://github.com/dehesselle/mibap) toolset together with the resource files inside the inkscape/packaging/macos directory. + +Follow the steps to install the toolset, package the app, and create a DMG. You will get the app under `/Users/Shared/work/mibap-*/` and you will get a DMG file in the same place you ran ./build_inkscape.sh. + + ## Problems -☎ _If you can't solve your issue with the information above, please [ask in the chat](https://chat.inkscape.org/channel/team_devel) or [report a bug](https://inkscape.org/report)_. +☎ _If you can't solve your issue, please [ask in the chat](https://chat.inkscape.org/channel/team_devel) or [report a bug](https://inkscape.org/report)_. + +Below, we present some typical workarounds. If these workarounds are needed, please still report a bug. Normally the instructions should work out of the box on a standard system. + +### No GSettings schemas + +If you encounter the following error (when, eg. going to open file dialog): +``` +(org.inkscape.Inkscape:91305): GLib-GIO-ERROR **: 11:18:06.449: No GSettings schemas are installed on the system +``` + +Then you have to modify the following: `export XDG_DATA_DIRS=$XDG_DATA_DIRS:/opt/homebrew/share` + +### Wrong library paths + +Some libraries can cause trouble if they are picked up from the SDK instead of Homebrew (observed with libxslt and libxml2). Adding them to `$PKG_CONFIG_PATH` should fix this. + + ## See also - [Contributing and Developing](../../CONTRIBUTING.md) - [Advanced Information on Compiling Inkscape](doc/build/general_advanced.md) + -- GitLab