Skip to content

Mac OS X Hints

Quickly expand compressed files in Finder

In this post, I lamented on the incredible slowdown seen when expanding many compressed files in Finder. To save a trip back to that article, here's the tldr; version:

Expand 24 .gz filesFinder:
12.8 seconds
Terminal:
.013 seconds
Terminal is 984.6x faster than Finder

With a bit of work, though, you can harness the power of Unix in Finder, and get both the GUI and the speed when expanding files. There are many ways to do this, including third-party apps such as The Unarchiver. You could also write an Automator Service to do the work for you. But I chose to write a Keyboard Maestro macro, because I could make the macro a menu bar option that only shows when Finder is frontmost:

As seen, I actually have two expanders, one that expands just the Apple sales reports mentioned in my original post, and the other that will handle any mix of compressed files. (Yes, the 'all files' macro could also handle the Apple sales reports, but because of how it has to run for multiple file types, it's marginally slower than the dedicated macro.)

These macros both work in the same way—they call on Unix apps to do the expansion, bypassing Apple's slow GUI expander (which is called Archive Utility). If you're curious how they work, and/or would like to download them for your own use, keep reading.

[continue reading…]



Replace the departed free iTunes Radio with free iTunes radio

In case you missed the news, Apple has now officially ended the free streaming of iTunes Radio. To listen to these stations now, you have to subscribe to Apple Music, which isn't something I want to use. (If they offered a "use but don't integrate into library," I'd subscribe in a heartbeat…but they don't.)

There are any number of other radio services out there - Pandora, Spotify, etc. But I wanted something that existed in iTunes, as I didn't want to have to run another app, nor (shudder) use my browser as a radio station front end. Then I remembered that iTunes has a huge—as in tens of thousands—assortment of Internet Radio stations.

I hadn't looked at internet radio in a long time, as I'd been quite happy with my selection of iTunes Radio stations. But Apple's move inspired me to take another look, and so far, I like what I've found. If you'd like to explore the world of Internet Radio in iTunes, here are a few tips to ease the exploration.

[continue reading…]



Total PDF pages in subfolders across folder structure

Last week, I wrote a script that ran through a folder structure and output the page count of every PDF in all folders and sub-folders, and also spit out a grand total.

While this worked well, what I really wanted was a script that just totaled PDF pages by sub-folder, without seeing all the file-by-file detail. After trying to retrofit the first script, I realized that was a waste of time, and started over from scratch.

The resulting script works just as I'd like it to, traversing a folder structure and showing PDF page counts by folder:

$ countpdfbydir
    47: ./_Legal
     2: ./_Medical-Dental
    15: ./_Medical-Dental/Kids
    11: ./_Medical-Dental/Marian
     2: ./_Medical-Dental/Rob
    35: ./_Personal Documents/Kids
    87: ./_Personal Documents/Marian
    28: ./_Personal Documents/Rob
    10: ./_Personal Documents/Rob/Golf
    12: ./_Personal Documents/Rob/Travel
-------------------------------------------------------------------
   249: Total PDF Pages

It took a few revisions, but I like this version; it even does some simplistic padding to keep the figures lined up in the output.

[continue reading…]



Count pages in all PDFs within a folder structure

Please see this newer post, with a new script that provides subtotals by subfolder, which is what I really wanted when I wrote this one.

Recently I've been trying to go paperless (well, mostly paperless) via a Fujitsu ScanSanp ix500. (I'll have more to say about the scanner in a future post).

One way to go paperless is to just go from now forward—start scanning stuff and don't worry about history. I decided that I'd go the other route, and work through our old paper files: some would be scanned and kept, much would just be recycled. The process went really quickly, compared to what I had expected. It helps that the Fujitsu is a wicked-fast document scanner!

But I was curious about how much I was scanning, in terms of total PDF pages—not files, but counting the pages in the files. Spotlight to the rescue; the field kMDItemNumberOfPages returns the number of pages in a document, and it seemed accurate in testing via mdls:

$ mdls /path/to/somefile.pdf | grep kMDItemNumberOfPages
kMDItemNumberOfPages = 4

So I set out to write a script to traverse my "Scans" folder, and return the total number of PDF pages.

[continue reading…]



On the vagaries of saving from Mail

As I suspect is true of many of you, I buy a fair bit of stuff from Apple, whether in a physical Apple Store or in the various online stores. I receive electronic receipts for all these purchases, which look something like this (but with all the personal info filled in, obviously):

Until yesterday, I have just filed all these receipts in their own folder in Mail (in the On My Mac section, so they're stored locally). But in the process of going paperless, I wanted to move them directly to my hard drive, so I could store them in a more-organized manner, and keep them alongside my other receipts. That meant saving the messages from Mail to the disk.

I had only two objectives when saving:

  1. Maintain the formatting and images in the original receipt
  2. Have the message content indexed by Spotlight

You'd think this would be a simple proposition, but you'd think wrong…the above two criteria are basically mutually exclusive with Mail's Save As feature. Read on for the details, and my eventually-discovered workaround (and labor-saving shortcut).

[continue reading…]



Use a mouse and keyboard…and a trackpad

When Apple released its new accessories, I thought it might be time to revisit my input setup. For a few years, I've been using the original Magic Trackpad and the Logitech Wireless Solar Keyboard.

While this setup has worked well for me, I missed the precision of a mouse (so much so that I kept a corded one nearby, and plugged it in when I needed to do such work). So I thought I'd check out Apple's new gear, with the thought of either upgrading to the new Magic Trackpad, or perhaps moving to the new Magic Mouse as my pointing device, and maybe replacing the Logitech with the new Apple keyboard.

Unfortunately, the local Apple Store only had the mouse in stock, not the keyboard or trackpad. Unable to compare the pointing devices, I just bought the mouse. After setting it up, I loved the added precision it provided over the trackpad. But if I was going to be using a mouse regularly, I wanted to narrow the reach from keyboard to mouse, so I pulled out my old Apple wireless keyboard, which is about six inches narrower than the Logitech.

This setup seemed really good, except that I'd be giving up a lot of features by removing the trackpad: I use it with BetterTouchTool and our own Butler (as well as Keymo and Moom) to execute all sorts of gesture-related actions.

[continue reading…]



Use Intel’s Power Gadget to keep an eye on your CPU

If you're the type who likes to keep an eye on your system, you may be familiar with tools such as Activity Montior's CPU meters, or iStat Menus, which displays a ton of system info via its menubar icon. Neither of these tools, however, really show you what the CPU itself is up to—and that's where an Intel-provided tool enters the scene.

The Intel® Power Gadget shows you exactly what your CPU is up to: how much power it's using, what speed it's running at, and its temperature. As seen in the image at right (click for larger), it graphs these three values over time.

The data you're seeing there is from my 4GHz Retina iMac, and the screenshot was grabbed while it wasn't doing much in particular. What really stands out to me is how often my 4GHz CPU is running at something closer to 3GHz; if the CPU isn't being called on for its full power, I'm assuming it slows itself down to reduce power usage.

But as soon as you do something that demands the CPU's full power, the napping stops. Here's a brief movie I created showing the CPU tracking when I started ripping a Blu-Ray:

The machine is basically idle at first, then I start the rip after 15 seconds or so. As soon as the hard work starts, the power and temperature charts shoot upwards, and over time, the CPU speed pegs right around 4GHz; the naps are gone.

I'm not sure how much real-world use this tool has, but from a geeky perspective, it's pretty cool being able to see exactly what your CPU is up to at any point in time. (You can even send the data to a log file, in case you really want to study power, speed, and temperature over an extended time period.)



How to search the archived Mac OS X Hints site

Late last year, just after its 14th birthday, Mac OS X Hints was officially put into a coma. The site exists online, but it's no longer accepting hints, and exists in a static state.

While it's great that this information is still online—as there are tons of still-useful tidbits there—it's apparently not searchable. When you enter something in the search box and press Enter, nothing happens…well, not nothing: The page reloads with an empty search box. Without search, the huge database isn't quite so useful.

The good news is that Google and Bing have indexed the static site, so you can use their search engines instead of the site's search engine. Even better is that you can build complex queries that aren't possible when searching directly on the site.

To search the hints site from Bing or Google, just include site:hints.macworld.com in the search string. A few quick examples:

While this isn't quite as handy as searching directly on the Hints site, it works well. (To make it easier, I've created a Butler search engine entry that searches hints via Bing.)



Fix Messages’ image pasting by killing its engine

Kirk McElhearn explains how Messages in Yosemite has trouble sending pasted images. These problems typically only occur between people who use AIM accounts in Messages; sending pasted messages when using iMessages' accounts seems to work fine. (I use an AIM account to keep iMessage traffic off my main Mac, and for its great screen sharing.)

Kirk's article details the fix, which is to kill the imagent process, which is what controls Messages. He uses Activity Monitor to do so, which works fine. But I have to kill the stupid imagent many times a day, so I wrote the World's Easiest AppleScript™ to do the work for me.

[continue reading…]



Span one large image across multiple printed pages

I was looking for a way to print a large image across multiple pages, so I could make my own do-it-yourself poster-size printout. By way of background, I wanted to print a huge virtual fire, to cover a piece of insulation we put in front of a drafty fireplace in the winter. (We don't like to burn wood, so the fireplace goes unused, but staring at a piece of shiny foam insulation all winter isn't all that interesting.)

Conceptually, this seemed pretty easy: find a huge image, open it in some app that handles images, and print. What I found is that doesn't work, at least not in the apps I had at hand (Acorn and Preview). After some web searching, I stumbled across an odd but effective solution: use Excel.

Open a new blank Excel workbook, then select Insert > Photo > Picture From File, and select your massive image. Now when you hit Print, you'll see the output spans multiple pages. I used Page Setup to select a borderless US Letter size, and printed out 16 pages of a roaring fire.

After some cut-and-tape operation, the drafty fireplace's insulation became more visually appealing:

Note that this was a "proof of concept" operation, so I printed in draft mode (hence the vertical striping on the printout) and wasn't overly careful about lining up the pages. I had originally planned to print the final version on glossy photo paper, but instead opted to buy a 36x48 poster-size printout from an online vendor. (I haven't yet received the print, but when I do, I'll post about its quality. Until then, though, I don't want to link to the vendor, as I don't yet know what I've bought.)

I knew Excel could do a lot, but I never thought to try it for printing huge images across multiple pages.