Skip to content

macOS

Count characters in Keyboard Maestro inputs via filters

Yesterday, I added an SSL certificate to my site, and posted a brief note about the change. In that post, I included an image…which turned out to be, well, the comments say it all:

Yes, I posted a non-https image in the 'site is secure' post. Sigh.

So I took Jonathan's comment to heart, and created a Keyboard Maestro macro that ensures I post only relative URLs from now on.

Generally, I don't think such a thing would be worth sharing, as it's just a basic text replacement macro, right?. Mostly right, but in this case, I learned about a Keyboard Maestro feature that may be useful to others. So share I will…

[continue reading…]



Magically achieve ‘inbox zero’ in Mail…or don’t

While working yesterday, I noticed that my inbox was empty. Generally, I strive to keep it that way, but I knew it wasn't true just then—my phone showed six messages in my inbox. Even stranger, using a Smart Mailbox in Mail, set to "show messages in inbox for Many Tricks," revealed the six messages. It was only when clicking into the mailbox itself that I couldn't see anything. At first, I blamed Mail…

Can you blame me, though, after my Mail search issues and the weird potential fix?

When I looked a bit closer, I spotted a clue that maybe it wasn't all Mail's fault. The "(0 filtered messages)" as seen in my tweet normally reads "(0 messages)." This was different, so I went looking in Mail's menus for "filter," where I discovered View > Disable Message Filter. Because the menu read "Disable," that meant the feature was enabled. I selected it, the menu switched to Enable Message Filter, and bingo, my inbox messages were back!

So what happened, and why wasn't it more obvious to me what had happened? The fault lies both with me and with Mail.

[Note: Glenn F wrote about this very issue for Macworld a few months back…sorry I missed it, as it would've saved some investigative work on my end!]

[continue reading…]



Open Unix man pages in their own Terminal window

A while back, I wrote about opening Unix man pages in Preview, and this is still my preferred method of browsing man pages. However, there may be times where Preview is overkill, and you want to stay in Terminal, maybe for a short help file such as that for ln. But opening a new window by hand is a bit of a pain, and tabs won't work because you can't see both the window and the man page at the same time.

While browsing the old Mac OS X Hints site, I found this nice solution: Open man pages in a new Terminal window, one that's set up just for reading such pages. It looks something like this (though I've customized my setup; keep reading)…

Adding a few lines to your shell's startup file makes opening these 'in their own window' man pages as easy as opening 'regular' man pages.

[continue reading…]



The little I know about regex…and where to learn more

First off, regex is shorthand for a regular expression. And what, exactly, is a regular expression? According to the linked Wikipedia page, a regular expression is…

…in theoretical computer science and formal language theory, a sequence of characters that define a search pattern. Usually this pattern is then used by string searching algorithms for "find" or "find and replace" operations on strings.

That's a mouthful, but what it means is that you can write some really bizarre looking code that will transform text from one form to another form. And if you know just a bit of regex, and where to go to look up what you don't know, then you can use regex to do many useful things.

For example, consider this filename on a scanned-to-PDF receipt:

The Party Place [party supplies] - 02-06-2017

Perhaps you'd prefer it if the date came first, in year-month-day order, so that your receipts were ordered by date, like this:

2017-02-06 - The Party Place [party supplies]

Sure, you could manually rename this one file, but what if you have 500 receipts that you need to rename? Enter regular expressions—they'll let you do this text manipulation, and many more. What follows is a very brief summary of my knowledge of regex, along with pointers to sites where I go when (very often) the problem I need to solve is beyond my regex skill level.

[continue reading…]



The useful yet useless Services menu

One of the most-useful tools in macOS is also one of the most useless: The Services menu. In theory (and occasionally actually true), the Services menu lets you quickly take action on something—a selected file or folder, or a chunk of text. In reality, the Services menu is a vaste wasteland of unused functionality, and a place where pre-assigned keyboard shortcuts go to hide from your attempts to use them elsewhere.

If you install a fair number of apps on your Mac, you may be surprised by the amount of stuff in your Services menu. Here's a look at my iMac, after I reset the Services panel (System Preferences → Keyboard → Shortcuts → Services) to its defaults:

If you're good at counting, you spotted 123 separate services flowing past. Not all are active, of course—"only" 58 are. Of those 58, you'll see some subset based on whatever you've selected…but even that subset can present itself as a huge list:

That's really not very helpful when you want to quickly apply some action to your selection. To make the Services menu useful again—and to potentially free up some keyboard shortcuts—you'll need to actively manage your Services.

[continue reading…]



More about macOS Sierra and Library shortcut keys

Yesterday, I wrote about an apparent change in Finder's Library shortcut key. To wit, it used to be that holding the Option key down would reveal a Library entry in Finder's Go menu.

However, on my iMac and rMBP running macOS 10.12.3—and on others' Macs, as my report was based on similar findings by Michael Tsai and Kirk McElhearn—the Option key no longer worked; it was the Shift key. But on a third Mac here, running the 10.12.4 beta, the shortcut was back to the Option key.

To further add to the confusion, a comment on the original article—as well as replies to the others' tweets—states that the user's Mac is still using the Option key in 10.12.3. So I thought I'd create a new user account, and see if I could figure out what was going on.

After some experimentation, I was able to discover why the shortcut key changes, and how to change it between Shift and Option at any time. This clearly isn't a feature, so I guess it's a bug, but it's a weird bug.

[continue reading…]



macOS Sierra minor update changes Library shortcut keys

Update: See this article for the cause of the shortcut key change. It's a bug, not a feature…I think.

Via Michael Tsai and Kirk McElhearn, today I learned that I've been giving bad advice to our users ever since macOS Sierra 10.12.3 shipped.

It used to be that holding Option in Finder and then clicking the Go menu would reveal an entry for the normally-hidden Library folder. In macOS 10.12.3, for reasons unknown, Apple has changed this: The only thing the Option key does now is change Go > Enclosing Folder into Go > Enclosing Folder in New Window. To see the Library folder entry, hold down the Shift key instead.

So that's the bad news: They changed an undocumented shortcut that many users have been told to use when troubleshooting. The good news is they added a better, easier, and faster way to get to the Library folder: Just press ⇧⌘L in Finder. This matches all the other shortcuts—⇧⌘O for Documents, ⇧⌘D for Desktop, etc. (Downloads is the odd one out, as it uses ⌘⌥L.)

Note: This may be a short-lived change, perhaps even a bug—it seems to be gone in the 10.12.4 beta release. Either that, or the 10.12.4 build is a bug, and it's supposed to be how it is now in 10.12.3. Hey Apple, I have some advice on how to fix this whole messy situation: Stop hiding the Library folder by default! (Note that you can unhide it by showing View Options (⌘J) on your home folder and checking Show Library Folder.)



Disable local Time Machine backups on laptops

Just noticed this post over on iMore…did you know that Time Machine automatically creates local backups on your laptop Mac? As described by iMore…

On Apple laptops, like the MacBook, MacBook Air, and MacBook Pro, Time Machine includes the added feature of creating local snapshots so that, if you disconnect your MacBook from its external hard drive, you'll still have backups stored on your internal hard drive so you can recover data if you need to.

While the iMore article points out how to disable/enable the feature (sudo tmutil disablelocal or …enablelocal in Terminal), here's a bit more detail not provided in the article.

First, this is not some hidden hack; you're merely changing a setting using an Apple-provided command line interface to Time Machine. Apple, for whatever reason, chose not to include this setting in the GUI, but you're not risking anything by making this change.

Second, you'll find the local backups in a root-only folder named .MobileBackups, at the top level of your hard drive. You can—sort of—see how much space they take up by selecting About this Mac from the Apple menu, then clicking on the Storage tab. On my MacBook Air, which has a 2GB local backup, I see 4GB of purgeable space, which I assume includes that backup.

To get the actual size of the local backup, run this command in Terminal:

sudo du -h /.MobileBackups/

Provide your password, then wait a bit. The last line of the output will be the total size of the folder, stated in gigabytes…

…
…
 23M	/.MobileBackups//Computer/2017-02-16-092144
2.0G	/.MobileBackups//Computer
2.0G	/.MobileBackups/

And finally, if you disable this command, how do you know you've done so, months from now when you've forgotten about this? Time Machine itself will tell you, on its System Preferences panel. (Sorry for the low-res shot; I only have local backups enabled on my 11" Air!)

As seen, after disabling the setting, Time Machine's System Preferences panel will no longer list local backups as one of the tasks it performs.



See the launch date and time for any app or process

I was working on something with Peter about Moom and its disk usage (it doesn't use much), and I was curious as to just how long Moom had been running on my Mac. I last rebooted my Mac a week ago, but I often quit and relaunch our own apps to run test versions.

Finder has this info, but that requires finding the running app in Finder. I wanted a quicker solution. In Activity Monitor (and ps in Terminal), you can see how much CPU time an activity has taken…

…but that doesn't really help at all with knowing when the app (or process) launched. As long as you're in Activity Monitor, you can get the information by doing the following:

  1. Click once on the app or process of interest.
  2. Press Command-I or click the small 'i' icon in the toolbar.
  3. In the new window that opens, click Sample, then wait.

When the sample is complete, you'll see its output, and included there is the selected item's launch date and time:

...
Analysis of sampling Moom (pid 89861) every 1 millisecond
...
Parent Process:  ??? [1]

Date/Time:       2017-02-15 07:41:18.611 -0800
Launch Time:     2017-02-13 19:44:11.957 -0800
...

That's all fine if you're in Activity Monitor, but a bit of a pain if you need to launch it, find the app, run a sample, etc.

As you might expect, there's another way via Terminal: The lsappinfo command, which queries CoreApplicationServices about any app or process on your Mac.

[continue reading…]



A possible fix broken search in macOS Mail

Over the weekend, I wrote about my totally useless search in Mail. I got so frustrated by my inability to search in Mail that I decided it was time to for a complete rebuild. I exported all my locally-saved mail, deleted my accounts, quit Mail, trashed its prefs and data files, rebooted, then rebuild it mailbox by mailbox, account by account.

I started with my iCloud account, which I barely use for anything—it has a total of seven messages in the inbox (four of which are iTunes Store receipts), and only 121 sent messages. As a test, I searched for Linea, an excellent drawing app that I had recently purchased. No matches.

At that point, I decided to quit Mail and force Spotlight to rebuild its index overnight. In Terminal, sudo mdutil -i on / will do just that (and take many hours). Today, opened Mail, and search was still dead. Argh! (I had also tried this suggested fix, but it made no difference.)

But doing some random testing today, I discovered a fix! It's a weird fix, but it seems to work:

If I move all the messages from an inbox or local storage folder into a different local storage folder, they'll be indexed and findable. I can then move them back into the inbox or source folder, and they remain findable.
Even more important, newly-added messages seem to be properly indexed, in both the inboxes and the local storage folders.

This doesn't make any sense to me, as any one of my recent actions—rebuilding mailbox indexes, reimporting, and redoing the entire Spotlight index—should have been enough to force a rebuild. But for whatever reason, only manually moving the messages seems to force a rebuild.

Now pardon me while I go back to manually dragging a quarter-million email messages around…