I spent a little bit of time trying to build MyPaint without MacPorts because I have Homebrew and didn’t want MacPorts to bork my system. Unfortunately, like Krita, it’s a pain in the ass to build. Thankfully, it’s not as cumbersome as Krita, but it still took a lot of time, and pressure sensitivity still doesn’t work. I loosely followed the readme here. I will just make notes here for stuff you need to adjust since that guide is catered for MacPort users.
Please note that I built this on Mavericks. I have no idea if the process will be different on Yosemite or El Capitan.
EDIT: There is a way to build MyPaint with pressure sensitivity. However, it’s very bleeding edge, and requires that you build GTK+3 from source directly rather than from Homebrew. Read my second post below this one when you get to installing GTK+3 if you want pressure sensitivity.
Setup environment variables
Just use the same export variables as in the guide. You will probably have to change the paths for them though.
PKG_CONFIG_PATH- where you will find .pc files for pkgconfig. If you hit on a folder with a ton of .pc files, then you’ve probably found it. In Homebrew, it’s under
CFLAGS- include folder for most libraries used as dependencies. On non-Macports (and probably Homebrew), this is usually under
CC and CXX flags- SCons, the build tool will use whatever default value you have set for the CC and CXX flags. My computer didn’t pick the right one, so if you get weird wrong architecture symbol errors, just set them:
export CC="clang -arch x86_64" export CXX="clang++ -arch x86_64"
I used Python 2.7 for this. You may not need the Homebrew version of this, but depending on how you have it set up, Homebrew prefers its version of Python. Which is okay, except that you will later have to tell SCons to use the Homebrew Python as well. Most of the dependencies below can be obtained through Homebrew. Sometimes, Homebrew will not link the dependencies because your system might have a version of it already. If you plan to use these dependencies for building MyPaint, you will have to link them. Use
brew link [dependency] for that. If you’ve already built Krita, some of these dependencies might look familiar.
pkgconfig(you can install this from pip or Homebrew)
gettext(if you install this with Homebrew, make sure it’s linked.)
gtk3(in Homebrew, it’s gtk+3)
pygobject3(if you install this with Homebrew make sure it’s linked. Note: this is not the same as python-gi. python-gi is only for pygobject2, and if you already have it, the gi module will not build properly with MyPaint. Make sure the one linked here is from pygobject3. You can find them in
libffi(this will probably be installed with pygobject3, but if you installed it with Homebrew, make sure it’s linked.)
hicolor-icon-theme(Should be installed with gtk3 if you’re using Homebrew)
libpng(OSX usually comes with this. If you don’t already have it, you should get it now.)
lcms2(in Homebrew, it’s little-cms2)
If you’re not building with Homebrew, you’ll need these as well:
Some dependencies you should install with pip:
sudo pip install [dependency]
pyobjc-framework-Cocoa(you do not need the entire pyobjc framework! Save yourself the frustration and time by only getting this one.)
Clone source files
As per the readme.
Note: If you build dependencies with Homebrew, you must tell SCons to use the
Python binary from Homebrew: In SConstruct, there is a line like
opts.Add('python_binary', 'python executable to build for', $). Replace $ with the actual path from the Homebrew binary:
Do the same for the python_config option below it as well, but link to
Then run SCons like in the instructions. I personally didn’t have to use
sudo -E, but your mileage may vary.
The readme suggests running the app with a -c flag, but I’m not sure if you absolutely have to specify it every time you run MyPaint. To automate that process (since there are no app bundles yet), I wrote a little script that you can run instead:
#!/bin/sh ./mypaint -c /tmp/mypaint_cfgtmp_$$
Just save it as something like
mypaint.sh and run it with
./mypaint.sh from your MyPaint folder.
MyPaint can’t find its icons
If you have attempted previous installs of other graphics software like Krita, you may have set up a
XDG_DATA_DIRS environment variable. MyPaint attempts to find hicolor icons from this variable, and it might not get added automatically. You will have to add it yourself. If you installed hicolor-icon-theme with Homebrew, the icons are under
/usr/local/share/icons (but linking
/usr/local/share should be good enough).
I actually looked at the portfile to see the missing dependencies that I
needed that weren’t in the readme. It appears that Homebrew tends to
build the dependencies for the dependencies listed in the portfile, so I didn’t mention cairo or glib except for building from source. Also, I did a clean install from a different computer without protobuf, and found it wasn’t required. Either that, or I already had protobuf and just didn’t notice it. If you need it though, you can get it through pip.
I’ve never actually tried the MacPorts build, so I don’t know if it just builds it from source and bundles an actual OSX app, or if it just dumps the build files somewhere and links them to what looks like an app, like the Homebrew cask version of MyPaint does (which is actually outdated, and the whole reason I wrote this guide). Bundling could be an interesting exercise though.