The AppStore Odyssey

Note: if you don't care about computers this will be mighty boring.

I installed a little app on my iMac from the Apple Store and I wanted it on my Macbook too. Simple, right?

So I open AppStore on the lappie, find the app and click on the FREE download.

But. Even though the app was free, Apple wants my credit card verification number, and I don't have it with me in bed. Solution: log on remotely to my iMac, zip the application, bring it over to the laptop, have fun. Simple, right?


But. My iMac is asleep across the street. I need to wake it up first. Simple, right? Just ssh to my linux server on its public interface and run etherwake, as it's in the same LAN as my iMac.

But. I don't remember the iMac's ethernet address and the last etherwake command is long out of bash_history. How do I find my iMac's MAC? I remember it's ARP-bound in the router, so all I have to do is log in to the router, go to the static IP table and copy it from there. Simple, right?

But. I can't remember the router admin password. It's on a post-it on my desk (our office is not open for public). Finally this problem has a simple solution: my Chrome browser syncs with the iMac's Chrome and the saved passwords are accessible on the laptop even though I've never logged in to the router from it. I open KeyChain, look around and here's the password.

But. The linux box only has text-based browsers. Nostalgic about the late 1990s, I fire up lynx.

But. The web interface uses frames. Lynx is useless. I take 15 minutes to read man elinkskeys. That is one useful piece of software. I open the web interface in elinks and it looks fine.

But. The navigation menu isn't HTML, it's generated on the fly from Javascript. And elinks, of course, doesn't know Javascript. That's ok, because I do. So I use wget to download the JS file and start executing it in my head.

But. The Javascript is intentionally obfuscated. This is better than Sudoku. Finally I figure out how the link to the ARP binding page is composed and I write it down. I use wget again to go straight to it.

But. The HTML table in it is empty; again it's populated dynamically using JS. I sigh, download another JS file, and interpret it mentally. I find the MAC addresses in a tucked away array, and YES! Here's the one for my iMac.

So I fire etherwake and I mentally hear my two external drives puffing to life in the darkness of the office. Quickly I ssh to the iMac and tar-gzip the app in /Applications. Then I scp it to the linux box, and then again to my laptop. One double-click and it's ready to run!

But. When I start the copied app, OSX says it's malformed or incomplete and won't run it. Poor. I ssh back to the iMac and have a look in the Info.plist of the app and find its registered domain. A "defaults read" command gives me a lot of saved preferences, I figure maybe that's what's missing.

But. There's quite a bit of saved data there, copy/paste will take forever, so I write a little script to change the output of defaults read into an input for defaults write, which I run on my laptop. Voilá: the preferences are identical now.

But. The application still won't start. I run Disk Utility and fix disk permissions. Still nothing. "Let me Google that for you" comes to mind and 10 minutes of searching reveal exactly nothing.

But. I remember I have logs. I quickly tail the most recently changed ones. Nothing there either. As a last resort, I try to fire it up using "open" and I get a different error message: binary file not found. Hmmm.

I go to the MacOS directory in the application and the binary is there, all executable and everything. But its filename is different from the name of the application. Looks like tar hates UTF-8 filenames.

Renaming the binary file was the last piece of the puzzle. The app is finally working!


Would've been easier to just get my fat arse off the bed and find the credit card, you say?


1 comentarii:

Definitely. Having got out of bed and typing 3 digits would've saved you all this pain.

I'd say it's pain well deserved.

And if you think I'm wrong, find that I, too, could find my way towards the bedroom by stepping out the door, going to the car, taking a 30 minutes tour of the city during the night and then getting back home and into my bed. But I don't do it whereas you kinda did.

Great story, BTW. Laughed my ass of.