Debugging a strange MacOS X printing problem

At some point in time, something changed on my system that resulted in my printer no longer printing. (Cue a relevant scene from Office Space here…) A quick Googling of relevant keywords didn’t turn up anyone else complaining about what I was observing, so I did what any lazy person would do: I found another way to print what I needed to print, and forgot all about it.

Now, several months later, the problem still persists, and while I found a suitable workaround (use the “Generic PostScript printer” driver instead of the Lexmark one), the hardcore geek in me felt it necessary to struggle against the injustice of this whole “it doesn’t work” thing. It should work, damn it.

First, here’s what the most obvious symptom looks like:

/Library/Printers/Lexmark/filter/pstopsprinter1 failed

Along with this will be an entry in the system log which you can see in

1/25/13 12:19:02.275 PM ReportCrash: Saved crash report for pstopsprinter1[78490] version ??? (???) to /Library/Logs/DiagnosticReports/pstopsprinter1_2013-01-25-121902_localhost.crash

If you look inside the crash report, you’ll see:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFArray length]: unrecognized selector sent to instance 0x1006036b0'

Great. Just great. So, we fire up our handy-dandy debugger, and what is the object it’s choking on?

(gdb) po 0x1006036b0
<__NSCFArray 0x1006036b0>

Aww, damn. I recognize what that is. Those are the domains defined in my /etc/resolv.conf‘s “search” parameter.

Here’s the whole backtrace:

(gdb) bt
#0  0x00007fff93b09ce2 in __pthread_kill ()
#1  0x00007fff9392a7d2 in pthread_kill ()
#2  0x00007fff9391ba7a in abort ()
#3  0x00007fff8ce037bc in abort_message ()
#4  0x00007fff8ce00fcf in default_terminate ()
#5  0x00007fff8d9931b9 in _objc_terminate ()
#6  0x00007fff8ce01001 in safe_handler_caller ()
#7  0x00007fff8ce0105c in std::terminate ()
#8  0x00007fff8ce02152 in __cxa_throw ()
#9  0x00007fff8d992e7a in objc_exception_throw ()
#10 0x00007fff954c81be in -[NSObject doesNotRecognizeSelector:] ()
#11 0x00007fff95428e23 in ___forwarding___ ()
#12 0x00007fff95428c38 in __forwarding_prep_0___ ()
#13 0x00007fff9539f426 in CFStringGetLength ()
#14 0x00007fff953affac in CFStringFindWithOptionsAndLocale ()
#15 0x00007fff953b67da in CFStringHasSuffix ()
#16 0x00007fff953ed7f6 in -[__NSCFString hasSuffix:] ()
#17 0x00007fff8e1ab6da in __-[NSHost resolveCurrentHostWithHandler:]_block_invoke_7 ()
#18 0x00007fff90497c75 in _dispatch_barrier_sync_f_invoke ()
#19 0x00007fff8e1a9b5d in -[NSHost resolveCurrentHostWithHandler:] ()
#20 0x00007fff8e1aa5a7 in __-[NSHost resolve:]_block_invoke_1 ()
#21 0x00007fff90495a82 in _dispatch_call_block_and_release ()
#22 0x00007fff904972d2 in _dispatch_queue_drain ()
#23 0x00007fff9049712e in _dispatch_queue_invoke ()
#24 0x00007fff90496928 in _dispatch_worker_thread2 ()
#25 0x00007fff9392a3da in _pthread_wqthread ()
#26 0x00007fff9392bb85 in start_wqthread ()

Well, let’s see what it was trying to resolve, maybe that’ll give us a clue:

(gdb) frame 20
#20 0x00007fff8e1aa5a7 in __-[NSHost resolve:]_block_invoke_1 ()
(gdb) po $rdi

Yup, that would be the DNS name of my machine, based on the reverse DNS of my IP address on my local private network. However, it appears that forward DNS for that FQDN isn’t resolvable, due to a recent change in my DNS setup. Let’s fix this, and correct the DNS so that the FQDN resolves, and test again.

Still fails. Damn, not going to be that easy, huh?

(gdb) frame 13
#13 0x00007fff9539f426 in CFStringGetLength ()
(gdb) info frame
Stack level 13, frame at 0x1003d72c0:
 rip = 0x7fff9539f426 in CFStringGetLength; saved rip 0x7fff953affac
 called by frame at 0x1003d7770, caller of frame at 0x1003d72a0
 Arglist at 0x1003d72b8, args: 
 Locals at 0x1003d72b8, Previous frame's sp is 0x1003d72c0
 Saved registers:
  rbx at 0x1003d72a8, rbp at 0x1003d72b0, rip at 0x1003d72b8
(gdb) po $rbx
<__NSCFArray 0x1006036b0>(

And, here it is. CFStringGetLength is expecting a CFStringRef and instead getting handed a NSCFArray, and is blowing up because CFStringGetLength trying to [str length] it.

I wish I knew someone who was doing OSX development at Apple to pass this bug along to …

Updated: I filed this as a bug in Apple’s Radar bug reporting system. It was assigned bug ID #13089829.

iTunes 11 is a total failure

ITunes 11

I just accepted the upgrade to iTunes 11 this morning, and am so incredibly disappointed. Can I downgrade back to iTunes 10.7? Thankfully, the iPhone wiki has an excellent list of Apple’s direct download links for past versions! Later, I’ll figure out how to uninstall this abomination and downgrade.

Removal of iTunes DJ is a huge mistake: it was the only feature of iTunes that actually kept me using it as a media player instead of using a non-Apple one. The “Up Next” functionality that Apple replaced it with is NOT a suitable replacement for iTunes DJ. The beauty of the iTunes DJ implementation was that it acted like a special Smart Playlist, which you could see both currently queued and previously played songs in one view, and easily drag-and-drop songs in the queue to rearrange their play order along with dragging new songs into the queue to play them in the order you want. While you can click-and-drag to reorder in “Up Next”, it’s far less configurable – matter of fact, I couldn’t find any settings in Preference that control the Up Next functionality.

Up Next? More like Up Yours, Apple.
“Up Next”? More like “Up Yours”, right Apple?

Changing the keyboard shortcut for MiniPlayer (e.g. Command-Shift-M to Command-Option-M) – why would Apple do something stupid like this? Do you not understand and value muscle memory in consistent User Interface design? The MiniPlayer was one of iTunes’s killer features, and part of its utility was its hotkey which a MacWorld article even included in its 10 essential iTunes keyboard shortcuts last year.

iTunes 10 MiniPlayer

Also, why hide the currently playing track information in the MiniPlayer?! Upgrades should be improvements that add or at least refine features, not remove useful features that existed in previous versions! Now, in order to see what track is playing or how long it is or to seek around in the song, I have to click on the cover art icon in the MiniPlayer, first?

iTunes 11 MiniPlayer
I mean, look at this. What is this garbage?

I know Apple recently fired Scott Forstall. I do hope Apple fires whoever the Product Manager is in charge of this iTunes 11 release. It looks like they were more concerned with the redesign of the application icon and overall visual design of the application and totally ignored the ridiculously stupid changes that were being made to its functionality.

iTunes 10 to 11 icon WTF?
Wait, someone thought this was an improvement?

Shame on you, Apple. It’s a good thing Steve Jobs is dead, because this kind of embarrassing change would have KILLED him.

Android USB tethering on Mac OS X

If you’ve got an Android-based phone, and want to do simple USB-based tethering on your Mac, you will find this guide useful. For reference, I performed this with the following equipment:

  • Samsung Captivate on at&t running custom Cognition 4.1.1 ROM.
  • MacOS X 10.6.6

The standard disclaimers apply here: follow these instructions at your own risk. This may void your warranty. Discontinue use if a rash develops.

Getting started: Preparing Android

All we need to do on Android is turn on “USB debugging” – do NOT fiddle with any of the “USB tethering” options or anything else. So, go into Settings > Applications > Development, and check the box next to “USB debugging.”

Android screenshots

After turning on “USB debugging” connect the device to your Mac using the USB cable.

Next, configure the Mac

After connecting the USB cable, your Mac should pop up a window saying that a device “SAMSUNG_Android” needs to be configured, like this:

Mac screenshot

This is a good sign. Click the “Network Preferences…” button, and find that device in your System Preferences’s “Network” section, which should look something like this:

Mac screenshot 1

The first thing to do is enter the values for this screen. Use the following settings:

Mac screenshot 2
  • Telephone Number: *99#
  • Account Name:
  • Password: cingular1

Next, click on the “Advanced…” button towards the bottom right of the window. That should bring you to a screen that looks like this:

Mac screenshot 3

First, click on “Generic” and select “Samsung” for the vendor. Next, click on “Dialup” and select “GPRS (GSM/3G)” for the model. Enter in “wap.cingular” for the APN. Leave the CID as “1” which is the default. When everything is done, the window should now look like this:

Mac screenshot 4

Once that’s done, click “OK” which should bring you back to the previous screen. Next, click the “Apply” button to save all these settings.

Lets try connecting

At this point, you’re ready to try tethering! Go ahead and click on that “Connect” button. You should now see something like this:

Mac screenshot 5

If everything goes well, after 5-10 seconds, it should change to something that looks like this:

Mac screenshot 6

That’s it, now you’re tethered

Not terribly painful, no goofy software installation needed and hoops to jump through. And, here’s a speedtest for folks who are curious:


3.4 Mbit/s down, and 330 Kbit/s up on a 400ms ping isn’t fantastic, but it’s more than adequate for getting work done while out and about.

I hope you’ve found this guide useful and are happily tethered now. If you have any questions or comments, feel free to share them in the comments below!

Added on 2012-11-20: A reader named Art emailed me about HoRNDIS: a USB tethering driver for MacOS X. This may be useful for folks who are still interested in USB tethering on OSX.

If I were Steve Jobs

Apple logo

As I cling tightly to my early 2008-era 15″ MacBook Pro with 2.6 GHz Core 2 Duo chip and 4 GB of RAM, I look on with desire at the new line of Core i5 and Core i7 MacBook Pro’s [13″, 15″, 17″]. Even the slowest Core i5 machine outperforms the fastest Core 2 Duo machine according to Primate Labs.

Fortunately for me, Apple makes it really hard to impulse buy new releases as they inevitably make decisions that just don’t work for me. Lets go down the list:

  • They removed the ExpressCard/34 slot from the 15″ model. It’s available on the 17″, but I’m not interested in the 17″. My laptop bag fits a 15″, but not a 17″.
  • Still no eSATA on the MacBook Pro? This might have been acceptable if they’d waited and included USB 3.0 ports, but they didn’t do this, either.
  • They removed the standard DVI connector and replaced it with Mini-DisplayPort. Ugh, why? If you’re going to switch, at least switch to a widely used connector: HDMI.

So, it looks like I’ll be waiting out this round of new hardware, too. My AppleCare runs out in 2011, so I’m hoping there’ll be another refresh of MacBook Pro hardware by then that incorporates USB 3.0, perhaps eSATA, and HDMI on the 15″ model.


I’ve also been thinking of replacing or at least supplementing our aging Series 2 TiVo with a Mac Mini, but again, I’m sorely disappointed with Apple’s decisions around the current version. The list:

  • Mini-DVI and Mini-DisplayPort? Again: Where’s the HDMI?
  • Only an analog audio out? S/PDIF, please! Not instead of, either, but in addition to.
  • No out-of-the-box SSD configuration option? Sure, this is an easily remediable after-market upgrade, but still …

For the most part, these issues aren’t really a show-stopper for me for what I intend to do with the Mini, so I’ll probably be budgeting for it for 2010.

My one last gripe: why won’t Apple make a wireless keyboard that has a trackpad built in? Sure, their Magic Mouse is neat but for the home theater use of the Mini, having a keyboard with a trackpad built in is a lot more useful for couch surfing. This seems like such a no-brainer to me, so I’m really hoping that a future Apple wireless keyboard with built-in trackpad becomes available soon.

My shiny new battery (thanks, AppleCare)!

Today, I was able to get my optical disk drive and battery replaced on my 15″ MacBook Pro. The ODD would intermittently fail to write disks. My battery wouldn’t hold more than 1400 mAh at full charge and only had 172 cycles on it.

Here’s what System Profiler says about my new battery:

Screenshot of System Profile battery info.

Oh happy day!

Making MacOS X usable without a mouse

I whined about not being able to manipulate modal dialogs without my mouse and one of my friends, Tom R., pointed out how to get OSX to behave as I had hoped. The trick? A System Preferences change:

  • System Preferences
    • Keyboard
      • Keyboard Shortcuts
        • Keyboard & Text Input
          • Full Keyboard Access: All controls.

Snow Leopard: Bring on the pain!

MacOS X 10.6.0 Snow Leopard was released over a month ago on August 28, 2009. While everyone jumped at the opportunity to be Apple’s outsourced QA, I followed my rule of “never use a dot-zero (.0) release.” Now, a month and a half later — and after the 10.6.1 update has been released — I’ve decided to install the upgrade.

Many people have suggested the upgrade was smooth and painless for them, and I totally believe this to be the case for probably 98% of Mac users, but I’m a developer and have installed lots of third-party (non-Apple) applications. I was completely expecting a bit of work to get my system running normally again, but my first symptom that something was wrong totally puzzled me: the system would stop performing I/O to disk, causing every process to spin the shiny hypnodisk at me. Basically, I could boot the system, and after about 3 minutes, everything would hang. So, keep this in mind as I describe all the things I fixed, because getting through each step involved several reboots just to make the necessary changes.

Here’s the list of problems I encountered and fixed:

Checkpoint SecureClient VPN

This complained at boot-up that the SecureClient service wasn’t started. A known work-around is to binary edit two files, StartupItemsMgr and SecureClientStarter and replace the string “kextload -s” with “kextload -r“. This worked for me.


The old MacPorts compiled against dependencies that are no longer available on Snow Leopard, including MacPorts.dylib itself. Luckily, I just grabbed the latest MacPorts installer .dmg for Snow Leopard which enabled me to selfupdate and upgrade outdated and get things working again.


Periodically, a dialog box complaining about Soundflower.kext popped up:


I had Soundflower 1.4.3 installed, which was the most recent release before Snow Leopard was released. Now, Soundflower 1.5.1 is available, so I upgraded to it. This appears to be sufficient to get it working again, too.

Oh, the agony …

At this point, my system appeared to be stable enough to use — no spurious errors being logged to /var/log/system.log and no more annoying hangs. I’m sure I’ll discover a few more annoyances next week when I start dealing with work stuff again, but for now I can at least use the machine again.

Was the upgrade worth it? I guess I’ll find out.

Tags: , ,

Is DRM finally going away for real?

Back in 2003, when I started working for AOL, there was a race to launch a digital music store for the Windows platform. The company to beat was Apple, who launched their Windows port of iTunes in October 2003. At that time, AOL was still claiming to have over 24 million subscribers. Clearly, if AOL could push out a digital music store offering as part of their service to that many customers before Apple, it might have made a difference.

But, wait … AOL launched its MusicNet offering as early as February 2003, you say? Beating Apple didn’t make much of a difference, after all, right?

I wasn’t directly involved in any of that work at AOL so I’m just speculating here, but I know a lot of effort went into rights management systems and DRM. I’m willing to bet a lot more effort went into getting all that stuff working than actual work on making the product–the music store–kick ass. I kept complaining that AOL should take advantage of its then-800-pound gorilla nature and spend its budget and manpower to invent and pioneer a business model that was DRM-less, rather than spend all that time trying to satisfy everyone’s wacky demands trying to implement DRM.

At the time, I kept hearing responses that all boiled down to: it’s not going to happen. I’ve learned that nothing happens unless someone makes it happen and AOL certainly could have been one to make it happen. This reminds me of a quote I love: “People aren’t resistant to change. Matter of fact, people will change just about anything in order to maintain the status quo.”

Fast-forward five years to 2008: Amazon, Walmart and even Apple (through iTunes Plus) are offering completely DRM-free music downloads. Somehow, things are changing from “not going to happen” to “it’s happening” to “it’s happened.” What makes me sad is that instead of rendering itself irrelevant, AOL could have pioneered this.

Regardless, I’m happy that we can finally start saying goodbye to DRM for real. Now, companies can start focusing on really innovating where it counts–identifying, funding, producing and distributing quality digital content–instead of on meaningless technology like DRM.

Tags: , , , ,

This is “high speed” EDGE?

This is my BlackBerry Curve 8310 tethered to my MacBook Pro over Bluetooth:

Not the “high speed 3G EDGE” I was expecting. Is this really the height of technological achievement for 2008? Where’s my flying car? Jeez.

Tags: , , , ,

MacFUSE + sshfs + underlying SMB mount = fail

One of the things I’m trying to do is mount remote filesystems on my Mac using MacFUSE and sshfs. In short, the idea is you use ssh/sftp to connect to a remote system and “mount” its filesystem (using the SSH connection) so that it appears as a mounted volume on your local machine. In general, this works great; you only need SSH access to the remote host–not SMB, CIFS, or any other standard, but perhaps firewalled, network file sharing protocol.

But, what if the remote filesystem you want to mount is actually a mounted SMB share? You would think it should “just work,” right? It kind of does, sorta. But, only sorta.

I start out by using sshfs to mount the remote filesystem:

dossy@shiny:~$ sshfs foobar:/share x -o volname=x

Nothing surprising: this just works as you’d expect. I’m mounting the subdirectory /share on foobar to my local mountpoint named “x” as a Mac volume named “x”. Lets make sure we can write to it:

dossy@shiny:~$ cd x
dossy@shiny:~/x$ ls -la
total 8
drwxrwxrwx  1 root  wheel  4096 Sep 13 20:40 .
drwxrwxrwx  1 root  wheel     0 Sep 13 18:23 ..
dossy@shiny:~/x$ echo "This is a test." > test.txt
dossy@shiny:~/x$ cat test.txt
This is a test.

There, we can write to this remote filesystem just fine–this is great! But, this was all from the shell, what about from the Finder? Ahh, this is where things start to suck hard. I create a small test file called “suckage.txt” and try to copy it to the sshfs mount:

Copying a test file to my sshfs mount in Finder

Attempting this copy operation results in this error dialog:

Copy: The operation cannot be completed because you do not have sufficient privileges for some of the items.

Say what? I don’t have sufficient privileges? Finder, you’re crazy. Watch this:

dossy@shiny:~/x$ cp ~/Desktop/suckage.txt .
dossy@shiny:~/x$ ls -la
total 16
drwxrwxrwx   1 root   wheel     0 Sep 13 21:49 .
drwxr-xr-x+ 35 dossy  staff  1190 Sep 13 20:57 ..
-rw-rw-rw-   1 root   wheel    20 Sep 13 21:51 suckage.txt
-rw-rw-rw-   1 root   wheel    16 Sep 13 20:45 test.txt

Looks like I had privileges just fine–why couldn’t Finder copy the file? I suspect it has a lot to do with the crazy AppleDouble nonsense that Finder messes with, none of which happens when I just copy the files in a shell.

I’ve spent at least an hour playing Configuration Option Bingo (you know, when you try turning on and off all the various configuration options until you get the permutation that solves your problem, at which point you want to jump up and shout out “BINGO!”) … with no luck. I’ve tried “-o noappledouble” and the other obvious things. I’m now giving up and blogging this, hoping that someone out there has figured this out and might share their secret; I sure couldn’t turn up anything useful by Googling, that’s for sure.

Tags: , , , , , ,