I had images in my mind of gleaming, bright, shiny metals but in the end, I thought this picture of a rusting cannon in Rhodes Town was a better photograph. And a better photograph is what PhotoFriday is all about!
Ever since upgrading from OS X 10.9 to Yosemite (10.10) I’ve been getting the above error message periodically. As far as I know I have no software that needs Java to run.
When I asked on Twitter, the most common suggestion was that it was the Adobe updater. But I don’t have PhotoShop or anything else likely installed.
I checked the system logs, but, again, nothing.
The final obvious — for a fairly broad definition of “obvious” — was in System Preferences. If you look in the “Users” pane, you can find a list of “Login items,” programs that are started when the computer boots. (I figured this wasn’t likely since the alert pops up at all time but it was worth checking.)
I think I found the solution but I found some interesting (if you’re geeky) new commands that I thought I’d talk about before I document the actual solution.
So the underlying system that the Mac uses to start programs periodically is called ‘launchd’ (or “launch daemon”). It’s kind of an amalgam of init and cron and a bunch of other standard Unix processes, a concept that is controversial in some circles. The interface, I found, isn’t terribly intuitive.
In addition to the long-running process, there’s a configuration program called ‘launchctl.’ The man page runs to several pages. ‘launchctl help’ is only slightly shorter.
I find the ‘list’ subcommand in the “legacy” section and give it a try:
$ launchctl list | grep -i java - 0 com.apple.java.updateSharing 98767 0 com.apple.java.InstallOnDemandAgent $
The columns are Process, Status and Label. So we can see that Apple’s Install On Demand Agent is running but not what triggered it.
There’s also a sub-command called ‘procinfo’. It’s not even “legacy” so it must be good… I certainly can’t complain about the volume of information, though I couldn’t claim to understand a good chunk of it.
Ah, but then I see ‘blame’ which the help tells me ‘Prints the reason a service is running.’ Ooh, yes please!
$ launchctl blame 98767 Usage: launchctl blame <service-target> $
Er, so what’s a service-target?
Anyway, long story short, I find that the text in the man page isn’t entirely clear and that I need to do this:
$ launchctl blame pid/98767/com.apple.java.InstallOnDemandAgent Not privileged to signal service. $
So, I don’t know. (If anyone could give me a sample command I’d be grateful!)
But, after all this messing around I did find something. The configuration for ‘launchd’ is scattered around the filesystem in directories like ‘~/Library/LaunchAgents’. I grep’d in that directory for “java” and found a single reference to it in an application that I installed ages ago and never used. The file is called “com.facebook.videochat.stephend.plist”. I deleted it and the other binaries related to it and then restarted.
Clean so far…
For some reason, when I saw the poster for the new movie “Fury,” I misread it as “Furry” and saw a beard on Brad Pitt that wasn’t really there. I’ve tried to correct these errors.
I was so busy when it came out that I never quite got around to blogging about it here: I have a new app out! It’s called ShareEverywhere. It is built exclusively for iOS 8 and uses the new, built-in “share” functionality, allowing you to share to a good number of services from any app that uses the standard share button.
When I first wrote it, I wasn’t sure how many, if any, developers would build share widgets into their apps. Now that we know the answer is “a lot of them,” I still use ShareEverywhere because it beats having a dozen widgets hiding in your action menu. And there are still services, like Pinboard.in, that don’t have their own native apps.
It’s available now in the App Store for your iPhone or iPad. It costs £1.49, $1.99, €1.79 or your local equivalent.
Maybe I have some duff feeds in my RSS reader. Maybe I have a few poor choices of people that I follow on Twitter. But I see links along these lines all the time:
How do you do something in Swift?
The answer is, almost always, exactly the same way you’d do it in Objective-C!
You want to do pull-to-refresh? Same.
You want to play with location services? Same.
You want to display one of the new UIAlertControllers? That’s the same, too.
Why? Because they’re all part of the underlying framework, the framework that’s there whichever language you’re using. That includes both Apple-languages — Swift and Objective-C — and everything else, C#, Python, Ruby.
That’s not to say that there is nothing useful to write about Swift. As a new language there are lots of things to write about, new ways of structuring your code, better ways of implementing algorithms. Tricks to avoid common errors or pitfalls. But interfacing with the OS? The syntax changes slightly but the code is pretty much the same.