Saturday 5 July 2014

Installing cherrytree on a Mac

Cherrytree is a terrific note taking software but it’s a big tricky to get installed on the Mac. Okay, not that tricky, but here we go…
I am working on Mac OS X 10.9.3.

The steps take here were suggested by zackpete on a cherrytree discussion list. Below is just a more expanded list of what I needed to do to follow that advice.

  1. As suggested on the MacPorts site, I installed Xcode and Xcode Command Line Tools.

    This took a surprising long time. Eventually, impatience won out, and once again I had cause to be grateful to those who take the time to document issues they see and ways to resolve things like this. Information on http://scheyeniam.blogspot.dk saved me, pointing out that I probably had a zombie storeagent process that needed to be killed. The steps I took here were:

    • Quit the Apple Store program.
    • Force killed the store agent process via the Activity Monitor. (Kill didn’t work, but if you come across this note, you should try an ordinary kill first.)
    • Restarted the Apple Store program.
    • Went to Purchases.
    • Clicked on the Resume button beside the Xcode app.

    At that point, the app installed really quickly.

  2. Agree to the Xcode license by opening and Terminal and running the command

    sudo xcodebuild -license

    Scroll to the end, reading all of it of course, and type in the word 'agree' if you agree.

  3. Install the Xcode Command Line Tools. I did this by using Spotlight to find Xcode, and then launching it. I was prompted to agree to install things that would allow me to run Xcode. So I agreed to that.
  4. I then had to run the command

    xcode-select --install

    To install the Xcode Command Line Tools.

    At this point, I'm not sure whether step 3 was necessary or not. But I'm too lazy to rip everything out and put it back to find out. Apologies!

  5. Install MacPorts as described on the MacPorts site.

  6. I think that XQuartz should be installed at this point. (I already have it installed, so no instructions are included here for this.)
  7. Update the MacPorts package index using the command

    sudo port selfupdate

  8. Install some dependencies. To do this, open a Terminal and use the command

    sudo port install python py27-pygtk py27-pygtksourceview p7zip py27-enchant

    The easiest way to ensure that the command "port" is on your PATH at this point (i.e. that the command called "port" can be found if you type in a command like the one above) is to open a new terminal window at this point.

    If you don't already have dbus-python installed, then you will need that.

    sudo port install dbus-python

    You then need to start up dbus using the following commands

    sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
    launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist

    If you don't run those commands, you will likely see an error saying that dbus does not have enough memory.

  9. Download the latest cherrytree source code.
  10. Extract the source code using the following command in a Terminal

    tar xvfz cherrytree-version.tar.gz

  11. Move into the unpacked cherry tree directory

    cd cherrytree-version
  12. You need to fix a problem that exists in the file that you will use to install cherrytree with before progressing to the installation.

    Use your favourite text editing program and navigate to line 208. At the time of writing, this was the final line of the setup.py file.
    Hash out the that line so it looks like this:

    #subprocess.call(“update-desktop-database”)

  13. Run the following command to install cherry tree

    sudo /opt/local/bin/python2.7 setup.py install

  14. You need to run cherry tree with the MacPorts python. One way to do this is to explicitly use the full path to that python, for example, from within the cherry treefolder, you could run:

    /opt/local/bin/python2.7 cherrytree

    That's pretty inconvenient though. My choice is to set up an alias for cherry tree so that when I type the name, it calls the correct command.

    For whatever reason the install command in the step above did not end up with cherry tree going into /usr/local/bin. However, that's fine with me. I moved the installation directory to a convenient location, and then set up an alias for the command, putting in the full path to the cherrytree executable.

    alias cherrytree=“cd /Users//mySoftware/cherrytree–0.33.4; /opt/local/bin/python2.7 cherrytree”´

    The reasons for running cherrytree from within the source directory where it was built is because if I didn't, then I got an error:

    Traceback (most recent call last):
       File "/Users/<username>/mySoftware/cherrytree-0.33.4/cherrytree", line 65, in <module>
       f_main(args)
        File "/Users/btiwari/mySoftware/cherrytree-0.33.4/cherrytree", line 46, in f_main
           import main
         ImportError: No module named main
    

Other troubleshooting


If you see errors like the following when you try to launch cherrytree:

´raise ValueError, 'unknown locale: %s' % localename´

then you probably need to add locale settings. For example, the following could be added to your profile.

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

5 comments:

  1. Hi, I just discovered this awesome app this evening. But the fonts on Mac Retina screen are blurry and really a pain. Do you know how to fix this issue? I've tried Retinizer but no luck. Thanks in advance!

    Really like this app except the font issue. I've bundled the app using Platypus and it worked well.

    ReplyDelete
  2. Hello. I agree that cheerytree is much nicer on Linux and Windows than on Mac. I'm afraid I haven't really looked into making the fonts better though. Good luck.

    ReplyDelete
  3. I got this to work on MacOS Sierra using these instructions. Thanks.

    One warning: copying and pasting from this blog page into a Mac terminal isn't advised, as dashes, quotes, and other characters don't get translated correctly.

    ReplyDelete
  4. A rather delayed thank you, Will, for posting that warning about copying/pasting. It's nice to know that you managed cherrytree up and running with the info on this page.

    ReplyDelete