Back to the Miscellaneous project page.
September 8, 2015
Installing Zim Wiki on OSX
Running programs meant for Linux are hard to run on OSX, especially if they use graphics. This is how I got Zim wiki running on OSX.
Installing Zim as a stand-alone app
After using a Linux computer for 5 years, my work environment changed and I am now using OSX full-time. One addition to my personal productivity suite has been Zim wiki, a personal wiki system made of a bunch of text files and a Python wrapper that I sync between my various machines / partitions using Dropbox. The downside of switching operating systems, I had to get Zim wiki running on OSX.
I took much of my inspiration from the Gnome-wiki page on building GTK for OSX and someone’s earlier blog post for how to package Zim as an app on OSX
- OSX Yosemite 10.10.3
- Zim 0.63
- Anaconda Python
- Homebrew for package management
- XCode 6.2
Here are my series of steps (for OSX Yosemite 10.10.3 and Zim 0.63):
- Download the Zim source files from the zim downloads page
- Make sure you have XCode, svn, git, curl, and OpenSSL installed. My package manager is Homebrew and I installed it with those, but people use different things. From here, the instructions are basically taken from the guide for setting up GTK for OSX
Download gtk-osx-build-setup.sh in your home directory and run it
In general, I prefer not to mess with environment variables, especially the
LD_LIBRARY_PATH, since I don’t want to mess up my work environment, and don’t want to have to keep track of changing them when I run Zim. So, my solution does not involve changing any of those variables.
This will install
jhbuild, but it is installed in
~/.local/bin/jhbuild. So make an alias for the
jhbuildcommand by adding this to your
jhbuild bootstrapat the command line
jhbuild build meta-gtk-osx-core
jhbuild build meta-gtk-osx-themes
jhbuild build meta-gtk-osx-python
jhbuild build pygtk.
- If all of the
jhbuildcommands run without a problem, you should be good to go to set up a stand-alone app. Of course, there are many ways for them to go wrong, but if you want help with those feel free to leave a comment or send me an email and I’ll try to help. From here the instructions come from a blog post about how to create a stand-alone Zim app. First, download Platypus. It is a program that can be used to bundle apps on OSX.
Run Platypus and change the parameters as follows:
- App Name: Zim
- Script Type: Bash
- Script Path: click “New” below the path, then replace
echo 'Hello, World'with
- Output: none
- Identifier: default
- Author: default
- Version: 1.0
- Uncheck all 4 options (including “remain running after initial execution”)
- Click the + sign for “Files to be bundled” and add the source folder for the Zim source.
- If you want the icon for Zim, then you can drag the
zim.pngfile from the
zim-0.63/data/directory into where the icon is
Click Create to create your app, and save it anywhere (the Desktop is a nice place.)
- Drag your new icon into the Dock, and you can click it to launch Zim!
I haven’t yet figured out how to get the tray icon working - I suspect I am missing a GTK plugin to build with
jhbuild, so if you figure it out, I am excited to know!
I had two main errors (with
jhbuild) that I was able to fix, and there are many more that can happen. I will describe my two errors here, and if you have others, feel free to post in the comments / email me and I’ll update this with more.
libxml2, or in general missing packages.
During some parts of the
jhbuild process I kept running into errors where I was missing packages when they clearly were there. This is most likely because
jhbuild is not building or linking the packages with the correct version of Python or GTK. To solve this, when an error comes up, I selected 4 from the terminal menu (i.e. open a
jhbuild shell), then
cd into the
Python-2.7.8 directory, and do:
make make install
Then exit the shell with
exit, and continue the build process. (Reference from this forum post).
After I finished all the
jhbuild compiling without errors, I ran into an error after packaging, where I would open Zim, but every “wrong”” movement such as random mouse clicks, backspaces too vigorously, or clicking some buttons would crash Zim horribly with the error that
libgtk-quartz-2.0.0.dylib plugin failure.
What fixed this for me was changing the default Python expected by Zim to Anaconda Python. The path for my Anaconda Python is in
/Users/mprat/anaconda/bin/python, while all the
.py files in the Zim source were expecting to use Python from
/usr/bin/python, as set by Linux. So I opened the Zim source files in Sublime and changed all the
#!/Users/mprat/anaconda/bin/python, and re-packaged the app with Platypus. After that, no
I hope this helps anyone else struggling to install Zim on their OSX machines!
All Posts about Miscellaneous
2018 September 3 -- Why I Left Amazon
2018 August 25 -- Blogging with Jupyter for Learning Julia Part 2
2018 August 17 -- Favorite Podcasts 2017-2018
2017 March 18 -- Blogging with Jupyter for Learning Julia
2017 February 15 -- Favorite Podcasts 2016-2017
2015 September 8 -- Installing Zim Wiki on OSX
2015 February 5 -- Word Frequency in the King James Bible
2014 February 13 -- A Fictional Middle East
2013 June 6 -- MIT Graduation Cap
2011 April 28 -- Playing Zork on Linux