How-to: Setting up Mono on Mac OS X, Part Two

Part 2 of a series; see Part One here

Continued from Part One:

At this point, follow the same process to install the CSDK, starting with the .dmg file, which is named in the same pattern. In my case, it was named: monoframework-csdk-2.6.1_1.macos10.novell.ppc.dmg. double-click it, double-click the resulting  drive icon, double-click the .pkg file…you know the drill.

Next steps

So, following the next step on the mono-on-os x introduction page, I wanted to get into some gtk# Hello World goodness. I created my file with the gtk# code in it, and entered the compile/run commands as per the web page. Boi-oi-oing! No good! I saw the following in my little Terminal window:

error cs8027: couldn’t run pkg-config: ApplicationName=’pkg-config’, CommandLine=’–libs gtk-sharp-2.0′, CurrentDirectory=”

A Fatal wrong turn

Those of you playing along at home can stop now. In my arrogance, I went way far down a dead-end alley from here. I took a bunch of unnecessary steps, rather than trying harder to Google up a solution right here.
  • Those of you who just want to get on with it, and see the actual solution to the error message above, go ahead and skip directly to Part Three and the solution.
  • For those who want to watch me squirm in embarrassment, I’ll recount the missteps I made next:

Having played around a bit with Linux in my misbegotten youth, I immediately suspected a missing package– that is, the gtk# software was missing some required software package. One of my least-favorite parts of dealing with Open Source software on *nix platforms had reared its ugly head– or so I assumed. As many strides as *nix, and especially Linux, has made in this regard, there are still way too many examples of this issue in Open Source. I decided to check the Mono site for help. While mousing around, I found a mention of the "MonoDevelop" tools, and wound up at the monodevelop download page. Hmm, this looks promising: a bunch of Tools Download links, and, below that, a recommended order in which to compile! And, second on that list, a gtk# download! Excellent! So, using the links on that page, we download and attempt to install the first item on the "recommended order in which to compile" list, Mono.Addins. Grab the file, open it. Uh-oh, more Open Source fun, we need to compile the sucker. Check the Readme. Follow directions for compiling it. Hmmm…it’s checking its dependencies. Start to worry a little… Sure enough, it can’t find gawk, awk, mawk, nawk, and, for all I know, hawk, tawk, shmawk, and… fawk! Oh noes! Then, an interesting little message: "You need to install pkg-config." OK, I can take a hint…

The (totally unnecessary) search for Spock pkg-config

Warning: this next step took me further down a blind alley, so, if you’re following along, as I noted above, don’t actually download and install pkg-config at this point!
So, the next part of my little misadventure: Googling me up some pkg-config. Found it: pkg-config. Downloaded it from the not-very-user-friendly download site. According to the INSTALL file in the pkg-config folder, you install it by typing ./configure at the Terminal prompt. Did so, and hit the <return> key: Boi-oi-oing! No good! What’s the matter this time?? Ahh… it’s looking for gcc, then cc. gcc is the Gnu C Compiler, as I know from my C Programming classes at N.Y.U. a lo-o-o-ong time a little while ago, and also my aforementioned days of messing about with Linux. a.out anybody? So. This bad boy wants to compile himself. OK.

My Kingdom for a C Compiler

Note: it’s OK to follow the next steps: Next, I once again begin plying every programmer’s best friend – Google. Need me some gcc on OS X. Hmm…Tech Recipes has a page titled Mac OS X install gcc compiler. Some interesting stuff about a set of Apple Developer’s tools called Xcode, which also contain gcc. Kill-two-birds and all that. Sounds intriguing. I’ll get my gcc, and maybe I’ll dig that C-Programming-Certificate stuff out of the back recesses of my mind, and play around with Objective-C and Cocoa (the OS X development language and GUI toolkit, respectively, for those of you who are strictly PC (not, not Politically Correct. PC as in IBM, as in Windows. Sheesh!). What’s this? Something about registering for an Apple Developer Connection account? But…but…I’m a Windows-Programmer-guy! What if Steve Ballmer, or someone looking just like him, comes to my door and beats me severely about the head and shouldersfor collaborating with the Enemy?? If only I had an account of some sort already with Apple, so that the Microsoft Mafia doesn’t divine my intent to collaborate with Apple using their evil Operating System bug/mind-reader which everyone knows is installed in every version of Windows- Oh, wait! Even Microsoft can’t be suspicious of my iTunes Store account, right? After all, even they probably use iPods…and it just so happens I can use that here! Hah!

But seriously, folks…It’s easy enough to finish the sign-up process at Apple’s Developer Connection site, click the "Downloads" link under the Member Areas heading, click the "Developer Tools" link under the Downloads heading, then find the most recent version of the Xcode x.x.x Developer Tools, and click the download link. In my case, since I have a rather…ahem…<cough><cough>… older PowerPC Mac with OS X 10.4.11 Tiger, I had to scroll way down until I found the "ancient" Xcode 2.5 Developer Tools, which were uploaded in…gasp2007!

The OS X Developer Tools

Installing the Xcode Developer Tools is straightforward, and I won’t bother describing the process in excruciating detail.

The Xcode installation leaves you with a new folder: Macintosh HD/Developer. Under this folder, you will find all the tools; the sub-folder Applications contains, which is the main I.D.E. for Cocoa and Carbon development, plain-old-C++ development, Java development, etc. Have fun; poke around a little.

Back to pkg-config

Again: don’t follow the next few steps; read, and laugh, instead.

Getting back to our adventure above, now presumably having all sorts of happy little compilers running around my system, I loaded up Terminal and cd‘d into the pkg-config folder on my Desktop. Typed in ./configure at the Terminal prompt again. Hmm…ooh, what’s this? Happiness! My "build environment is sane"! Yay! I think… Uh oh, what’s this? Didn’t find gawk,mawk, or nawk…but…wait for it…awk! It found awk! It found gcc! And the ANSI C header files! Break out the champagne? The lines continue to scroll down the Terminal screen…lots of yeses!! A few nos, but it seems to have installed! Hallelujah! Though it took a few minutes, and spat out hundreds of lines…so be patient.

According to the INSTALL file in the pkg-config folder, the next step is to type make install. Wait, what’s this? Permission denied? Uh oh…wait, I remember that under Unix, the "master account" is root. And there’s a command that lets you temporarily take on another user’s privileges, su (Switch User, I believe). Try that: su root. Uh oh, it wants a password! The person who gave me the Mac didn’t say nuthin’ bout no stinkin’ "root password"! Now what? Ah, yes, "Google is your friend"! A quick Googlage turns up instructions for enabling and/or re-setting the root password…but, wait! Among the instructions is another Unix command I dimly recall…sudo! Yes! A command that lets you run a single command as a privileged user! Which my regular account should work for…type in the whole schmear: sudo make install…OK, now it wants my password! But this time I simply use my regular password…or, for those of you not following security recommendations and using a (deity forbid) blank password, <shudder><shudder>, you can leave the line blank and whack that <return> key…OK, good. Seems to have worked! We don’t need no stinkin’ root password! Hooray for those few weeks I wrestled with Red Hat Linux 5 all those moons ago! And had to format partitions using the primitive tools…"Merlin" or something? Not sure…alright, enough whining. Back to my little Terminal window…everything seems OK, and the INSTALL file says we should be good to go– for now, I’m ignoring the stuff about cleaning out the binaries from the source directories. Can always do it later. What? You want to know what sudo stands for? Hmm…I don’t know if I ever knew that, other than it might be a play on the word "pseudo". Don’t really care, either. Now, let’s see if all this actually accomplished anything…

Installing Mono.Add-ins — try #2

OK, so I change back to the mono-addins directory and try the ./configure command again…wait, what’s this? NOOOO…it still can’t find pkg-config! Drat! Back to Google…OK, found this page Pkgconfig version 0.23 – How to Download and Install on Mac OS X Hmm…something about DarwinPorts? OK, I’ll go with it…signed up, downloaded Dawin Ports, followed the instructions…problems! Finally realized that the version of DarwinPorts which automatically downloads is for the wrong version of OS X for my machine! If you notice, on the download page that comes up, that says "Your download will begin shortly", there are checksums for the different versions of DarwinPorts, for the different versions of OS X…and next to each checksum is a link for the proper version of DarwinPorts for that version of OS X! There’s a link for Panther, Tiger, and Leopard! Once I downloaded the right version of DarwinPorts, and followed the instructions on that page, and the previous page linked above on How to download and install pkg-config on OS X, everything worked! Yippee Yahoo!

Installing Mono.Add-ins — try #3

So we change back to the mono-addins directory and try the ./configure command yet again. Hmm…it’s not finding the gtk# package! Grrrr!!!
And I’m still totally barking up the wrong tree here! All of this was unnecessary!

At this point, I’m too frustrated to continue, so look for the next segment in Part Three…along with the simple steps I should have taken in the first place!

Currently listening to: The Pixies – Doolittle – Here Comes Your Man

  1. Leave a comment

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: