Tag Archives: mac

watchedinstall is useful

Very satisfying to use [watchedinstall][wi] at work the other day to see exactly what a tricksy meta-package was doing during installation. Now that I [fixed a stupid bug involving dtrace][bug], watchedinstall works a treat for recording exactly what goes where.

Many thanks to [Preston Holmes][ptone] for releasing watchedinstall in the first place.

My goal is to replace the functionality of the fsevents helper application with a [dtrace][dtrace] script that can list filesystem changes. A single python script would be simpler to install and use – you wouldn’t need to install it at all, just run it from the directory you downloaded it to. No effing about with setting PATH environment variables, no worry about compiling a C program for whatever architecture.

Hey Esther!

[wi]: http://bitbucket.org/davidbuxton/watchedinstall/
[bug]: http://bitbucket.org/davidbuxton/watchedinstall/changeset/d97aaae628c3/
[ptone]: http://www.ptone.com/
[dtrace]: http://www.sun.com/bigadmin/content/dtrace/

Tea Timer widget

Finally found a use for [Dashboard][dashboard] with [Stefan Scherfke][stefan]’s [Tea Timer][tea].

[stefan]: http://stefan.sofa-rockers.org
[tea]: http://stefan.sofa-rockers.org/teatimer/
[dashboard]: http://www.apple.com/downloads/dashboard/

Removing printing restrictions in 10.5

I am trying to write a good one-liner for removing all restrictions on printing for Mac OS X 10.5. I had thought that [`sed`][sed] would be perfect for this, but I can’t arrive at a simple syntax for appending new lines that works well when pasted into a terminal window. Here’s what I ended up with:

perl -p -0 -i ‘.bak’ -e ‘s/(Policy default).*(Policy)/$1>\n\nOrder deny,allow\nAllow from all\n<\/Limit>\n<$2/s' /private/etc/cups/cupsd.conf Rather brutal, it just guts the default policy and replaces it with the following:

Order deny,allow
Allow from all

Greg Neagle has [a useful article about printing in the enterprise][mactech]. Apple suggests [adding the network group to the local lpadmin group][ht3511], but points out that mobile users would need to be added individually. In my case most accounts are mobile accounts and we trust everyone to manage print queues on a Mac, so removing all restrictions is acceptable.

[mactech]: http://www.mactech.com/articles/mactech/Vol.24/24.06/2406MacEnterprise-LeopardPrinting/index.html
[ht3511]: http://support.apple.com/kb/HT3511
[sed]: http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/sed.1.html

Snow Leopard: a reactionary writes

Things I like about [Mac OS X version 10.6][sl]:

(Mac OS X 10.6 is also known as Snow Leopard, although I dislike Apple’s use of the operating system codename in their publicity material because it leads to conversations where people talk about “Leopard” and “Tiger” and one has to stop for a second to translate those to actual operating system versions and no-one is ever going to refer to [Mac OS X 10.3 as Panther][panther] these days, let alone [10.2 being Jagwire][jaguar] or heaven forbid [Puma][puma] and [Cheetah][cheetah]. What are the chances I’ll have to look up the codename for 10.5 by the time we reach 10.10? Version numbers are not so evocative but are less confusing than codenames. This doesn’t mean I will stop naming hard disks after Mac OS codenames – my desktop has [Veronica, Gershwin, Harmony and Sonata][codenames] connected at the moment, with [Copland][copland] and [Pink][pink] sitting on the shelf as appropriate…)

Things I like about Mac OS X Snow Leopard:

– Apple’s drivers for my Epson all-in-one printer / scanner actually work. Epson’s drivers for the same printer / scanner only worked if you never used the scanner and promised to attend church more often.
– Significantly snappier.
– QuickTime Player’s minimal interface.

Things I dislike about Mac OS X Snow Leopard:

– By default the Finder does not show internal disks on the Desktop.
– The Finder [ignores type / creator codes][typecreator] on files.

Everything else in 10.6 is good. However it strikes me that the de-emphasizing of old-style Mac metadata (type / creator codes) and the default of not showing your computer’s hard drive icon on the desktop are evidence of the triumph of old-school Next-ies within Apple.

I think the decision to cover-up the hierarchical filesystem is a bad thing.

P.S. Wouldn’t it have been awesome if, having released Mac OS X Cheetah, Apple had continued with naming their releases after other famous Hollywood animal actors? Why they stopped naming releases after [disappointing Sylvester Stallone movies][sly] is beyond me – most any version of System 7 could have been named [Lock Up][lockup].

[sl]: http://www.apple.com/macosx/
[leopard]: http://www.apple.com/support/leopard/
[panther]: http://www.apple.com/support/panther/
[jaguar]: http://www.apple.com/support/jaguar/
[puma]: http://en.wikipedia.org/wiki/Mac_OS_X_v10.1
[cheetah]: http://en.wikipedia.org/wiki/Mac_OS_X_v10.0
[codenames]: http://www.mackido.com/CodeNames/MacOSSoftware.html
[copland]: http://lowendmac.com/orchard/05/1108.html
[pink]: http://lowendmac.com/orchard/05/1026.html
[lockup]: http://www.imdb.com/title/tt0097770/
[sly]: http://www.imdb.com/title/tt0118887/
[typecreator]: http://arstechnica.com/staff/fatbits/2009/09/metadata-madness.ars

Network users and Mac 10.5 archive and install

When upgrading a Mac from Mac OS X 10.4 (Tiger) to 10.5 (Leopard), remember that network accounts are _not_ included if you do an archive and install and choose to migrate existing users. If a network account had its home folder at `/Users/jbloggs` then it will have been moved to `/Previous Systems.localized/2009-11-06_0346/Users/jbloggs` (although the date portion will be the date that you did your install).

This applies to [network accounts which authenticate against Active Directory and do not have a mobile account][kb].

Why my place of work used to setup Macs with the option for create mobile account at login turned off is a mystery to me.

[kb]: http://docs.info.apple.com/article.html?path=ServerAdmin/10.5/en/c7od45.html

Excel scroll bar bug

[Microsoft Excel 2008 for Mac][excel2008] has an irritating bug where only the active document window has scroll bars. If a second document is open, or even if you only have one document but Excel is not the front-most application then the window has no scroll bars and ignores scroll messages from the mouse. This happens in Excel 12.2.0 (and a couple of earlier revisions behave the same).

Excel scroll bars in inactive window

Excel scroll bars in an inactive window

The correct behaviour is for [scroll bars in inactive windows to be drawn in an inactive state][hig] and to allow scrolling even when the window is not front-most.

I rather like Excel. I thought it was the least crashy of the assorted junk Microsoft released as Office 4.2 for Mac back in 1993. Fuck me that was a pile of shit.

[excel2008]: http://www.microsoft.com/mac/products/Excel2008/
[hig]: http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/XHIGWindows.html#//apple_ref/doc/uid/20000961-TPXREF26

10.5.7 fixes AppleShare speeds

The recently-released [Mac OS X 10.5.7 update][1057] fixes the atrocious AppleShare transfer speed bug that was introduced by 10.5.6. The problem was that copying files larger than a few hundred kilobytes to certain AppleShare servers (including Mac OS X Server 10.4.11) would go *extremely* slow, and usually fail after a minute.

But copying files from the server to your Mac was hunky dory! Fun.

I like to think the programmers at Apple refuse to consider allowing software to be released until they have written comprehensive tests for regression testing. I like to think I do the same (I don’t, but I respond faster when you want my attention).

[1057]: http://support.apple.com/kb/HT3397

Package installer wish

Mac OS X administrators frequently need to build installer packages to
help deploy and manage software on a network of Macs. The motive for
creating a package is one of

* Packaging software that does not have a dedicated installer. This applies
to all the nice drag-and-drop applications like [Firefox][firefox] and
[Cyberduck][cyberduck].
* Packaging your own site’s software, whether that is as simple as printer
descriptions or as complex as a full-blown application.
* Re-packaging some miserable piece of shit installer that either totally
denies the harsh reality of Apple’s non-cross platform installer formats or
which manages to make such a balls of an install package that you were
better off before they bothered.
[Most everything by Adobe is in this category][adobeinstallers].

The first of those three is very common, and it ought to be easy to
create packages for existing installed applications.
[Apple’s PackageMaker][packagemaker] application provides a nice interface
for creating packages, but it has two drawbacks:

* PackageMaker is not installed by default on Mac OS X (it gets intalled as
part of the Developer Tools).
* Before PackageMaker 3 (part of Xcode 3, which requires Mac OS X 10.5)
there was no *simple* method for quickly packaging an installed application.

What I want is a package creation tool that works on a 10.4 system without
requiring the developer tools and which can be scripted. The `packagemaker`
command-line tool requires an existing `Info.plist` file or `.pmdoc` file
if you want to set a custom default installation directory – not the end
of the world, but tedious.

Useful links
————

* [Iceberg][iceberg] is an excellent graphical tool for building packages, by
Stéphane Sudre who also wrote up the…
* [PackageMaker how-to][pmhowto] which is a very useful introduction to the
details of `.pkg` files. Bit out-of-date these days.
* Man pages for the command-line [packagemaker][man1pm] and for the
[installer][installer] tools.
* Apple’s [software distribution documentation][softdist], which is very
quiet on the subject of custom installer plug-ins. Xcode has a template
project for an installer plugin, and the `InstallerPlugins.framework` headers
have lots of information.
* [Installer-dev mailing list][installerdev], where the people who wrote
the tools and documentation help out a lot.
* [JAMF Composer][composer] which is part of the Casper management tools.
Version 7 is no longer free.

[firefox]: http://www.mozilla.com/firefox/
[cyberduck]: http://cyberduck.ch/
[packagemaker]: http://developer.apple.com/DOCUMENTATION/DeveloperTools/Conceptual/PackageMakerUserGuide/index.html
[adobeinstallers]: http://blogs.adobe.com/OOBE/
[iceberg]: http://s.sudre.free.fr/Software/Iceberg.html
[pmhowto]: http://s.sudre.free.fr/Stuff/PackageMaker_Howto.html
[man1pm]: http://developer.apple.com/DOCUMENTATION/DARWIN/Reference/ManPages/man1/packagemaker.1.html
[installer]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man8/installer.8.html
[softdist]: http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution
[installerdev]: http://lists.apple.com/mailman/listinfo/installer-dev
[composer]: http://www.jamfsoftware.com/products/composer.php

Adobe’s download manager

I had to install a trial version of [Adobe Flash CS4][1] the other day, and came across their latest tactic in making the world more complicated and hateful: the Adobe download manager.

adobe-download-manager

From [the miserable user guide][2]:

> Adobe Download Manager is a stand-alone application that improves the process of downloading files from Adobe. Adobe Download Manager provides the following benefits:

Here the document explains the benefits point by point. I dislike those benefits.

> * Selects an Adobe product download destination

On a Mac, Adobe download manager ignores your download destination as set in the browser’s preferences. For Mac OS X 10.5 Apple went so far as to add a “Downloads” folder to the standard set of folders in an account. Adobe download manager prefers the “Desktop” and thinks you are wrong.

> * Allows you to pause downloads
> * Allows you to resume interrupted downloads

My browser already allows me to pause and resume downloads.

> * Allows you to download multiple files from a single links

I don’t see why clicking a single link and unexpectedly getting multiple downloads is good. Other single links don’t do that.

> * Allows you to download your products securely

As well as supporting HTTP, my browser supports an encrypted version known as HTTPS.

> * Verifies download integrity and completion

I accept that a regular download says nothing about the integrity of the file itself, and that this can be a problem. The geeky / secure way to fix this is to provide verifiable checksums for file downloads. But if the file is inadvertently corrupted then a disk image is likely to fail to mount (so you would know it was incomplete). If the file is maliciously corrupted then why would trusting Adobe’s Java download manager to verify the file be any better than trusting the file in the first place?

> * Leads you to the installation of your product

On a Mac there are [existing guidelines for packaging software][3] which do a better job of leading the user to the start of the installation process.

> * Provides a simple interface

It is simple. But the existing download methods are simple, and are familiar. Why would a new simple interface be necessary?

> * Provides System Tray downloading (Windows only)

Good for them. But irrelevant for Macintosh users, as is the helpful text on the download page that explains I will be downloading two files, an .exe and a 7zip archive, both of which are needed (unless you download the Mac version).

> * Provides background downloading

You mean even when I’ve explicitly quit my browser session your downloader ignores me and keeps working? Why?

> * Provides assistance with finding the download

If the download was saved in the expected folder and used the recommended install behaviour then I wouldn’t flipping need your assistance you arrogant twats.

Ugh.

Download managers were genuinely useful ten years ago when large file transfers were likely to be interrupted either because the server was at capacity or the client’s connection was unreliable (i.e. dial-up modems being forcibly disconnected every hour by your ISP). But I don’t need a download manager in 2009, not even when downloading a 1.36 gigabyte disk image file. I have a 40 megabit pipe and I don’t want to download another piece of software just so I can download a piece of software.

However Adobe’s download manager is not optional. If you want to download the Flash CS4 trial then you are required to use their downloader. Other Adobe patches and updaters are available without having to install the download manager, but this one absolutely will not work without you running a Java application in your browser!

But it is unnecessary. My browser is perfectly capable of saving the file to disk in a timely fashion, and it even knows how to pause and resume a transfer because it understands how to send the Range header in an HTTP request.

I wish Adobe would put the right people back in charge. The Java downloader is a pretty minor thing, but it smacks of a disregard for the simple and standardized mechanisms provided by a platform. In this respect it is much like Adobe’s continued refusal to kill [their terrible custom Mac installers][4].

Once I got Flash CS4 up and running I found myself wondering why it kept crashing. And then I realized that Adobe has changed the behaviour for Flash CS4 so that [*closing the final window quits the application…*][5]

My spirits sank lower.

[1]: http://www.adobe.com/products/flash/
[2]: http://kb.adobe.com/selfservice/viewContent.do?externalId=159990ae
[3]: http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Containers/chapter_3_section_1.html
[4]: http://www.betalogue.com/2008/11/13/adobe-cs4-installer/
[5]: http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/chapter_18_section_5.html#//apple_ref/doc/uid/20000961-TPXREF56

Setting Mac Office 2008 default save formats

[Microsoft Office 2008 for Mac][1] uses the new [Office Open XML][2] formats by default
which is a pain in an office where many staff will be using previous versions
for some time.

You can easily change the default save format within the preferences for Word,
Excel and PowerPoint, but the simplest thing when deploying Office 2008 to a
whole bunch of machines is to set the default format once and have every user
pick up that setting.

Fortunately Microsoft Office 2008 uses the [system defaults database][3] and even
honours preferences from the Library domain.

Here’s the preference files in `/Library/Preferences` for Excel, PowerPoint
and Word:

computer:~ david$ ls -al /Library/Preferences/com.microsoft.*
-rw-r–r– 1 root admin 256 29 Jan 14:21 com.microsoft.Excel.plist
-rw-r–r– 1 root admin 301 29 Jan 14:21 com.microsoft.Powerpoint.plist
-rw-r–r– 1 root admin 257 29 Jan 14:14 com.microsoft.Word.plist

Contents of the Excel plist to save in Excel 97-2004 Workbook (.xls) format by default:

computer:~ david$ cat /Library/Preferences/com.microsoft.Excel.plist


2008\Default Save\Default Format
57

I wonder what the significance of 57 is… Probably meaningful in hex or something.

PowerPoint plist to save as PowerPoint 97-2004 Presentation (.ppt) by default:

computer:~ david$ cat /Library/Preferences/com.microsoft.Powerpoint.plist


2008\Default Save\Default Save\Default Format
Microsoft PowerPoint 98 Presentation

Word plist to save as Word 97-2004 Document (.doc) by default:

tfg02215-2:Preferences dbuxton$ cat /Library/Preferences/com.microsoft.Word.plist


2008\Default Save\Default Format
Doc97

Let’s create these all using the `defaults` command in one go:

defaults write /Library/Preferences/com.microsoft.Excel “2008\Default Save\Default Format” -int 57
defaults write /Library/Preferences/com.microsoft.Powerpoint “2008\Default Save\Default Save\Default Format” “Microsoft PowerPoint 98 Presentation”
defaults write /Library/Preferences/com.microsoft.Word “2008\Default Save\Default Format” “Doc97”

Sweet.

Now any new user on that machine will pick up these preferences and will use
the old formats by default (but can choose to use the new formats by changing
preferences if necessary).

[1]: http://www.microsoft.com/mac/
[2]: http://msdn.microsoft.com/en-us/library/aa338205.aspx
[3]: http://developer.apple.com/documentation/Cocoa/Conceptual/UserDefaults/