Getting ChocTop to Work

I have been working on creating custom DMGs for release builds for Popcorn Maker FCP, the Mac version of Popcorn Maker. I have ran into many issues along the way, some of which were explained in my last post, “DPS911 Release 1″.

In short, I want it so that when users download Popcorn Maker FCP, the DMG they open will have some custom images. For example, this can be seen when downloading Firefox:

Firefox Custom DMG 1

After many hours of running into problems, I finally figured out why I kept getting an error every time I used the install_choctop command (which is added to the system after adding the choctop gem, using sudo gem install choctop). It turns out the activesupport gem, one of choctop‘s dependencies, version 3.2.0 breaks compatibility, as explained in this GitHub issue. Before fixing the issue, I decided to install rvm, Ruby Version Manager, in order to manage multiple ruby environments and gems. It would make it easier in the long run if I ever needed to rely on a different version of ruby, and different versions of the gems I have installed. So I installed ruby version 1.8.7, installed choctop, and uninstalled activesupport gem version 3.2.0 and kept the older version.

Running install_choctop in Popcorn Maker FCP’s directory now adds the appropriate files to my project. It’s finally not throwing errors when I start to use it. Now I actually want to create my DMG, so I run the rake dmg command, but it doesn’t work. After doing research I realized that it was because choctop depends on RubyCocoa, and apparently it wasn’t installed on my system. Following the advice from this ticket on GitHub, I ran the following command

ruby -r osx/cocoa -e “p OSX::RUBYCOCOA_VERSION”

to see what version of RubyCocoa I have installed, but I got an error saying

ruby: no such file to load — osx/cocoa (LoadError)

This was interesting. I spent quite a bit of time digging around, moving around symbolic links, and trying a few things here and there and hoping to somehow get lucky. Of course, none of that worked. But I eventually found this post online, “Install RubyCocoa on RVM”. I am using Mac OS X Snow Leopard, and it comes preinstalled with ruby. It turns out that if you install your own custom version of ruby, you need to build RubyCocoa from source. The above post, along with several gists containing similar solutions, outlined the steps needed in order to do that. Except I wasn’t able to build from source because Apple dropped PowerPC support in Xcode 4, and the compiler needed by one of the steps in installing RubyCocoa relied on that. So tried following these instructions from StackOverflow, but still couldn’t get it to work.

Eventually I reverted back to the system ruby and tried to see what version of RubyCocoa I had installed. It didn’t work, but that’s when I remembered I had installed a version of ruby via brew to take place over the system installed ruby. Again, the ruby installed using brew is a custom ruby, and for RubyCocoa to work with this custom installation, I needed to install it from source. But I couldn’t get RubyCocoa to install successfully. So I uninstalled Homebrew’s ruby, installed RubyCocoa 1.0.2, and ran this command again

ruby -r osx/cocoa -e “p OSX::RUBYCOCOA_VERSION”

this time getting an output of “1.0.2”. Now rake dmg works, but it fails due to a bug in the program. Luckily, someone made a pull request with the fix, but it hasn’t been pulled in yet. I decided to clone the ChocTop repository from GitHub, and locally merge in the pull request with the fix. After that was done, from ChocTop’s root directory, I ran

sudo gem install pkg/choctop-0.14.1.gem

to create the gem. I finally have everything I need. I went back to Popcorn Maker FCP’s directory, gave the Rakefile a sample background to test out, and ran the rake dmg command again. It works! Now I need to make it look the way we want it to.

This entry was posted in Open Source. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s