Getting qt4-qtruby-2.0.3 running on Mac OS X (and Qt)

Posted in Development, Software on August 21, 2009 by osake


Please bear with me to share a little history of how I even got an interest in trying Ruby/Qt on the Mac.

In the past I’ve tried to learn GUI development.  The biggest roadblock (aside from the learning curve) was getting one installed with all its dependencies.  And maybe I’m asking for it when developing on a Mac.  They’ve always been company provided, so I’m not going to whine too much.

Some time ago, I co-presented on a GUI toolkit talk at my Ruby user group (KCRUG).  My compatriots chose Ruby Cocoa and Gtk, while I chose Shoes (I miss you _why).  I wasn’t just chosing Shoes to be eclectic, but I wanted ease of cross-platform.  Shoes to me also seemed easier to get up and running at the time.

So now, you should understand where I’m coming from.  I want cross-platform and I want something simple to setup.  Well, unfortunately, my portion of the presentation was a fail.  Not the presentation itself, but I was unable to get what I needed to talk to Wee War’s site and do anything.  Even with an excellent Wee War API wrapper in Ruby done up by Sean.

Shoes (still young at the time) wasn’t going to float for me any longer.  It did receive constant love from contributors to the source, but the struggle for me to achieve anything on par with the excellent sample apps ruined my glorious vision of triumph with a simple, elegant tool.  Someone recently gave me their thoughts on why Shoes failed me, and maybe its true.  I just couldn’t adapt my comprehension of programming to the Shoes DSL.

Gtk and Cocoa.  Well, let’s just dump Cocoa now, I had no interest in limiting myself.  So after that presentation (which mind you, was done in an Ubuntu VM), I tried to fire up the whole Ruby/Gtk thing native on the Mac.  After flailing for a few days, I caved in and abandoned my search for some time.


Well, a little more history, but relevant to the post topic.  Something recently spurred my interest in Qt.  I’ll be the first to admit that I’ve always used Gnome, Windows, or Mac for my windowing system.  I do occasionally boot Knoppix, but I really don’t get too deep into Qt stuff.  Oh yeah, and I’ve used/currently use many things that have their claim to fame in Qt.

I tried hitting up TrollTech to get started.  No go, the link I found was dead with no redirect or anything.  A quick search clued me in to Nokia’s recent involvement.  This is fine by me, there is still an LGPL version and now it’s funded love.

Let’s review real quick, my requirements: must be cross-platform, I’d like to do it in Ruby if possible, and I have to be able to get it working natively on my Mac.


As of this post, here is what I had to grab (oh yeah, you’ll need Xcode I’m pretty sure, comes with your Mac though)

  • Qt (4.5.2 from Nokia)
  • cmake (2.6.4 from cmake)
  • ruby (1.8.6, compiled version of Ruby)
  • qt4-qtruby-2.0.3 (2.0.3 from RubyForge)

I installed Ruby first since I do that professionally.  Qt was next, and I actually went with the full SDK in case I want to explore outside the realm of Ruby, or find limitations or interests that take me back to C++.   I then made the mistake of trying to just build qt4-qtruby.  You need cmake to build it, so get cmake up and running.  I actually used the binary dmg and linked it up in my shell path during installation.

Now, just so you don’t spend a lot of time asking why cmake in the source dir fails, let’s get you on the right foot off the bat.

$ cmake -Wno-dev \
-DRUBY_INCLUDE_PATH=/usr/lib/ruby/1.8/universal-darwin9.0 \
-DRUBY_LIBRARY=/usr/lib/libruby.1.dylib \

You may need to change your Ruby paths, but the other options will help get you through cmake and make.

I saw a more detailed build on phosphorescence‘s blog, but my cmake params should suffice.

After cmake is complete:

$ make && sudo make install

Feel free to break that up, but I just like getting it all done in one pass.

The next headache that plagued me over night and into the morning was that my build was successful, but I was unable to complete the ‘helloworld’ example.

require 'Qt4'

app =

hello ='Hello World!')
hello.resize(100, 30)


Line 1 was throwing a LoadError exception for ‘qtruby4’.  I am not terribly good at figuring this sort of thing out.  I mean, I know what it’s saying, but I don’t understand why.  To my knowledge everything was done correctly.  I spent several hours in IRC and searching forums last night.

I came across a German post which Google tried to help me with it’s translation, but I didn’t quite grasp what the fellow was saying.  At this point, I tried a few things before going to sleep and eventually gave in to the sand man.

The next day, I popped in IRC and low and behold, Richard Dale himself was there.  A short while after summarizing my issue, he blessed me with the answer.  For my installation:

$ cd /Library/Ruby/Site/1.8/universal-darwin9.0
$ ln -s qtruby4.bundle

So really, just change to whatever directory contains your compiled qtruby4 library and create the symlink to qtruby4.bundle.  Go figure.  I’m tempted to spend a little time understanding what these .bundle files are, but that’s another story.

Top 10 Reasons _NOT_ To Own A G1

Posted in Hardware, Rant on December 4, 2008 by osake

I thought I would try and be objective after talking up the G1 with a top ten list.  Some of these are resolvable by just writing applications, so I expect the list to shrink over time (or maybe I’ll find new aggravations):

10. Battery seems weak, especially when you have crappy service coverage and the phone is constantly searching for signal.

9. OpenGL ES version is not the latest and greatest.

8. T-Mobile’s 3G infrastructure is still really weak.

7. No multi-touch gesturing (is this patented by Apple?).

6. Some navigation is awkward requiring the use of buttons and screen touching.

5. Alert notifications cannot be customized by type.

4. No way to kill (manage) applications that are running in the background.  I really want to know what kind of resources the apps are using when I return to the home screen.

3. Not enough storage for applications pack rats such as myself.

2. No native PDF support.  Gives a nice error though 🙂

1. MachDice.  A really sweet die rolling application that uses the OpenGL library that doesn’t exist on the G1 yet.

Top 10 Reasons To Own A T-Mobile G1

Posted in Hardware, Rant, Software on November 20, 2008 by osake

In other words, ten reasons I don’t own an iPhone (or the G1 is just as good).  And in no particular order, here they are:

10. It’s not AT&T.  Honestly, I don’t have a terrible grudge against them, but several people I am close to do.  My service provider happens to be T-Mobile as well.  Call me a shill.  Meh.

9. It has a physical keyboard.  I had a Blackberry as my last data phone.  Definitely spoiled by full qwerty access and the tactile response.

8. Applications that I write can easily be put on the phone, for free.  Last I checked, you have to pay out $99 USD and own a Mac.  Neither of which I had after buying the phone itself.  I still would like to own a Mac though.

7. My fairly content relationship with Google.  I enjoy most of the services that Google provides and having a device that is built to play well with my internet love affair is just dandy. (Yes, I refuse to capitalize the internet…take that!)

6. 3G.  Okay, my city doesn’t have it yet, but the end of the year is going to level the playing ground in most major US cities with our competitor.

5. Cross-platform development kit.  Maybe a little unfair to fill the list with dev arguments, but the fact is, you can develop for this phone on your choice of three major operating systems.  Thanks Java.

4. ShopSavvy.  I was a little pessimistic about this app after some bad luck with its lacking database, but it has grown tremendously since opening day.  I’m going to retire my other barcode scanning apps now.

3. Standardized USB communications port.  It looks a little wonky, but it works fine with a Mini-USB connector.  I know iPhones use that connector similar to the iPod, which I own, but I own far more Mini-USB cables, and I like being able to switch between all my other devices without carying a bunch of different cables.

2. ConnectBot.  It’s an SSH app that rocks the block.

1. I can find Uranus any time thanks to this stellar app called “SkyMap”

There are still several improvements that could be made to the G1, and maybe I’ll gird my loins up to write a top ten to counter this list.  I do admit that, as of today, I would buy maybe an iPod touch so that I could have that MachDice, die rolling, app currently available on the iPhone/iPod touch.

Rails Rumble 2008

Posted in Development on October 20, 2008 by osake

Oh boy, this weekend was a blast.  To top it all off, Sunday was my 33rd birthday.  I am going to break down my team’s participation in Rails Rumble 2008 right here before your very eyes.

Friday Evening

We had decided earlier in the week to go ahead and start from home on Friday and get a good night’s sleep before meeting up Saturday at one person’s house.  Our team was also short a member for the first part of the competition.

Initially, we sat with baited breath at 6pm Central (at least I did) and then realized that we are still observing DST which caused the start clock to be 7pm instead.  It worked in our favor though because we were short a guy initially and planned to meet the next day anyway.

Once the timer started, I worked on the server setup and other system tasks while my partner was cranking out the base application.  Pretty rudimentary for a start, but had to be done.  We also decided to try and be at the host’s house around 9:30-10am the next day and really punch out some work.


I woke up late and on top of that my carpool was running behind and to keep the run-on sentence going, the host had just woke up by the time we got ready to head over to his house.  I thought, “Rock on, this is going to be an awesome day.”  Okay, I didn’t really think that…

We arrived and setup our laptops.  I was the only non-Mac user, and my laptop is so old and dysfunctional that I couldn’t connect to the wireless.  Fortunately, the boy scout in me thought to bring some ethernet in hopes of having a jack to plugging in to.

We had to sacrifice the XBOX 360’s network so that I could participate with internet access.  Oh, the drama!

We broke out a whiteboard and started talking through our idea a bit more than the scant pre-rumble meetings.  This was also important because our Friday night AWOLer, who was our designer, was in attedance.

With the game plan solidified, we were seated in front of many donuts and donut holes, plenty of soda options, and a 60″ plasma playing Bee Movie (in progress).

This is where I get tired of journaling the entire adventure, so to summarize, I consumed:

  • half a dozen donuts
  • half a dozen donut holes
  • easily 8 20oz sodas (Diet Mt.Dew, Diet Dr.Pepper, Cherry Coke Zero…and more!)
  • a double burger and cajun fries from 5 Guys Bruger and Fries
  • a dozen cookies (home cooked, not sure if home made)
  • 6 slices of pizza (Papa Johns)
  • scrambled eggs
  • 2 slices of toast
  • chips w/salsa and cheese dip

We also turned on about a half dozen movies to varying degrees of completeness and a few TV shows.

Before we got too far into the actual design of the logo and other style choices, we decided to name our application “Back In Black” to play off the accounting world where being in the red is bad and black is good.

Later in the evening, our designer had rolled out a our logo and good start on the styling of the application.  And somewhere along that time, someone queued up AC/DC’s song “Back In Black”.  As the design neared is initial phase of completion, the energy levels went through the roof.  A good design can be a great motivator.

During the wee hours, we began to lull a little bit and even took a few power naps.


As the morning hours neared, we gather ourselves and defined a checklist of remaining goals that we wanted to see completed before turning in the final product.

We quickly hammered out the last few features and even had time to add one last feature over the following hours until deploy time.

I had already been doing deploys to ensure that worst case scenario, we had something on the server by the deadline.  There was a kink.  As I went to do the actual deploy, I had to restart Apache so that it would take the phusion changes and the new virtual host.  Uh oh, error!  What?  Why?

It turned out to be something simple in the realm of permissions.  Crisis averted, we were set.  Application turned in, ready to be tagged.  But wait!  Another problem.  Great, this is the way of software isn’t it?  An IE problem.  Fortunately, the team was quick to solve the bug, we pushed the changes, tagged the branch, bid our farewells and grabbed a container of cookies to take home.

The End

View our completed project at

Damage Assessment:

  • consumed way too many calories (didn’t bother to weigh myself when I got home)
  • ear ache (might be a sinus infection) exacerbated by lack of sleep
  • I aged another year (though it’s been 365 days coming …had to calculate for leap year)
  • wet keyboard from wet dog beard (golden retriever style)
  • dog snot on pants and face (from the little guy, I forget which breed)
  • pizza sauce on my bright green shirt…very festive
  • delirium from lack of sleep

Huge thanks to Eldon for hosting and coding skills and Scotty for design and coding.  I was going to fly solo for the rumble this year, but it was easily 10x more fun with a team.  Thanks to Eldon’s wife for hooking us up with the food and drink and his pets for their entertainment.

Test First

Posted in Development, Zen on October 17, 2008 by osake

I got a great lesson in test first today.  I had fixed a bug earlier in the week, but I really didn’t get much gratification.  I also had to test it, realize another problem, fix again.  You should see a pattern forming here.

So I called up another team member and asked for some help figuring out how to get a spec (a.k.a a test) to cover this error in the event that there is a change in the future.  It was kindly brought to my attention at this point that I should have written the spec first anyway.  This is part of the whole methodology that we’re following anyway.

I reverted my code and wrote a few specs, passing each as I went along.  Sure enough, there was the gratification I was longing for.  Now the code is a bit more hardened.  I could have easily written the specs after the code fix, but there are two problems:

  1. The specs may not have enough coverage, it’s just too easy to be lazy in this direction
  2. You understand the solution to the bug better because you are describing how the application should behave

Here’s my light analogy: Your lightbulb burns out, finding a bug and fixing it is like just replacing the 60W bulb with the other one that came in the 2-pack you bought.  Writing a spec first, then fixing the bug is like putting in a 75W equivalent CF bulb to replace that incandescent.  Hoo ahh!  Yeah, it’ll cost more, but you’ll save money over the long term and burn a heck of lot brighter (at least mine do).

It’s A Boy!

Posted in News on October 3, 2008 by osake

Just found out yesterday that we are going to be having a boy.  I am more interested in a healthy baby, but definitely preferred a boy.  This will be my first baby and he should be coming out sometime early first quarter.

Shortest post ever!

Changing Jobs

Posted in Uncategorized on September 6, 2008 by osake

A week is in the books at my new gig.  I’m not a consultant (at least by day), I’m a pretty typical nine-to-five guy…okay, nine-to-six.  This is more about the emotions of the transition rather than a guide for changing jobs.  I am composing within “Josh’s Journal” after all.

I will rewind back to Thursday, August 14th.  I had a slip of paper in my bag that was making me gut-wrenchingly ill.  When I work for a company for more than five years, uprooting myself is extremely difficult and painful.

I was actually heading into the final quarter of my seventh year.  I should also elaborate by saying that I’m a very dedicated person and don’t like to move around too much.  I’m sure that not everyone feels the same attachment to five years in a position, but felt a deep bond with my company forming and became all the more drawn into it, adding hooks day-by-day.

There was a point, that Thursday, where I considered going home sick.  The insightful readers might be seeing a bit of my non-confrontational side coming into play.  I said a prayer, and headed into the big office, my 8.5×11 “Get Out Of Jail Free” card in hand.  I didn’t feel like I was truly imprisoned, but I did feel like I was fixin’ to make my way to Free Parking to pick up some spending money, then on the way down to Boardwalk.

After a bit of dicussion and inquiry from the recipient, I headed back to my desk.  Feeling a bit better, I still had a little over two weeks of work to be done.  For the state of my employer there is no reason to really give any notice and there is no reason for them to hold to any such terms either.  It’s called “Right To Work”, which I believe is more intended for unions, but still plays a part in my employment.

The days to come were all over the board for me.  I don’t recall it being all that interesting.  Likely, the most interesting bit was stating my last day was the 29th, but that I’d be happy to help out.  So, I got to help alright.

The 30th was my first day of helping.  It wasn’t too bad.  Then there was September 1st.  Dread.  That’s the emotion that you feel for a few days when it clicks that you agreed to help out.  Ah yes, a chance to work on Labor Day.  Well, I must have done something right.  Monday rolled around and there was no work to be found.

Tuesday came quickly for me.  I hurried out the door to start my new job.  I always liked the first day of school and this day, as with my other jobs, is just like a first day of school for me.  Most people like Friday, when the “What is your favorite day?” question arises.  Mine, to be honest, is my first day of school.

At the end of my first day, I was very tired.  It’s not a physically exhausting job, but I didn’t even care to do much when I got home except eat and sleep.  Maybe I’m starting to sound like Michael Phelps (swim, eat, sleep).  He’s pretty good at what he does, maybe it’s a good formula.

Summing up Tuesday’s emotion: confused. (This isn’t bad, I just wanted a one word summary.)

Wednesday was similar to Tuesday, still very new, still learning my way around.  I suspect that I’ll still be in “new guy” mode for a bit longer.  Since I’m not a manager, I don’t really need to assert a strong voice right away.  I don’t mind, I like to learn anyway.

Summing up Wednesday’s emotion: eager.

Thursday was the first day that I really had a ton of time to learn my job directly.  It was simply amazing.  I’ve never done my similar jobs like this before.  The days seem to fly by so quickly.

Summing up Thursday’s emotion: amazed.

Friday ended my weekas I am accustomed to already.  It really didn’t feel like the average Friday.  I usually cannot wait to get my weekend started.  Sometimes there are events that exacerbate the feeling, but today could have gone on forever.  It was simply revisiting Thursday’s glory.  Being able to contribute and having contributions freely accepted is just beautiful.

Summing up Friday: grateful.  Summing up the week: a prayer answered.

It’s easy to stay faithful in success.  It’s the trials where your faith must persevere.