File system check exit code is 8.

I should have realised something was wrong when Lightroom previews were taking so long to generate. The disk holding my photo archive is corrupted, and macOS “First Aid” reports an exit code 8 when it does a file system check.

Luckily, the disk still mounts, and I have another disk where I can copy everything off, and multiple backups, but this is not a nice thing to wake up to.

On the other hand, there are hundreds of thousands of files there, and the file system check couldn’t tell me which ones were corrupted, and might need to be restored from Backblaze.

Pause Time Machine for large files?

Warning: this is potentially terrible advice as it disables your backup system temporarily, or until you remember to enable it again. It also deletes backups which might be needed if you need to restore a file that was modified during this period.

When downloading massive files like the 50GB tgz archives from Google Takeout on your Mac, you might consider temporarily pausing Time Machine backups. This can help avoid the creation of enormous snapshots that quickly consume your free space. It’s a bit perplexing, though—my Time Machine backup disk is always connected, so I’m unsure why snapshots are generated at all.

In theory, the operating system should delete or move those snapshots to your backup drive, but it seems to take its time. While most advice suggests leaving snapshots alone, some external tools can be finicky about free space. For example, Backblaze has complained when my internal drive space got too low.

To get an accurate picture of your available space, check the Storage Settings in System Settings. However, it can be disconcerting when the df -h command shows a much smaller figure. To quickly recover space, you can use Disk Utility’s “Show APFS Snapshots” feature to examine and delete any large backups.

Just remember to re-enable Time Machine as soon as you’ve moved those large files elsewhere. This approach does carry some risks: disabling your backup system leaves you vulnerable to data loss, and deleting backups may prevent you from restoring files modified during this period. Proceed with caution!

How to: a keyboard shortcut to lock your Mac

For many years, I was using a hot corner to lock the screen of my Mac, but I always wished there was the equivalent of Windows-L in Windows to do it.

I have no idea when this keyboard shortcut was added, but tapping the CTRL-CMD-Q shortcut will lock your Mac screen. Apparently, if you have a small magic keyboard, then CTRL-Shift-Eject will do the job too. This Stack Exchange Question shows the shortcut wasn’t available in 2015. Users had to resort to all sorts of tricks to lock their screen with the keyboard. An updated answer from 2019 reveals the shortcut, so I guess it’s at least four years old.

An apple on the side of the road
An apple on the ground. Like shortcuts, you never know what you’ll find.

Hot corners are great and all, but I’ve had so much trouble making sure the cursor stayed in the corner. I’d watch to make sure my mouse didn’t move, and the screen remained locked. Otherwise, I turn my back, I’m heading out the door and the screen lights up again!

Loads more keyboard shortcuts here if you’re interested in that sort of thing. That page may also explain why something strange happened on your computer while you were typing into the wrong window and changed a Finder setting, for instance.

Have fun getting locked.

Restore terminal access to Dropbox on macOS

Dropbox just updated and moved the Dropbox folder to ~/Library/CloudStorage/Dropbox, a secure location. There is still a symlink from ~/Dropbox to that folder, so hopefully any local scripts will continue working.

The first thing I did was open an iTerm2 and attempt to look in ~/Dropbox with cd Dropbox. As it is hard-coded in my brain, when I change to a new directory, I will want to see what’s in it, so I immediately typed ls -l. Too fast for my own good, as I noticed the flicker of a dialogue appear and disappear when I tapped the return key.

~/Dropbox » ls
ls: cannot open directory ‘.’: Operation not permitted

I had denied iTerm2 access to the Dropbox directory. Oops.

Thankfully, it’s easy to fix. Open up the Security & Privacy settings in System Preferences. Go to the Privacy tab.

Click on Files and Folders and scroll down to your terminal programme.

You’ll see a new checkbox there for Dropbox. Click the lock to authenticate and click the Dropbox checkbox.

Go back to your terminal, and you’ll be able to see what’s in ~/Dropbox once again.

HOW-TO: get rid of the screenshot preview in macOS

A good few years ago, Apple changed how their screenshot function (CMD+SHIFT+4) worked by adding a small preview before it was saved. This allows you to edit the screenshot before it’s saved and used.

I can count on the fingers of one hand the number of times I used that to edit the screenshot. More often than not, I (metaphorically) drummed my fingers waiting the couple of seconds it took for the preview to disappear, so I could upload or do something with the screenshot.

How do I get rid of it? I looked around for a solution ages ago, but my Google-fu failed me. Last year I looked again, and I found this post that describes how it’s done.

Because this is probably something you want to do but never realised it, I’ll repeat what they said there. This is how you stop the floating thumbnail preview when you take a screenshot in macOS. It’s so easy!

  1. Press CMD+SHIFT+5 to launch the screen capture app.
  2. Click on Options.
  3. In that menu deselect “Show Floating Thumbnail”.

So simple, but it will save many precious seconds throughout my day!

Many years ago I set the location of screenshots to a screenshots folder, so I have been into that options menu. Maybe the floating thumbnail setting wasn’t there at the time.

HOWTO: Fix missing Thumbnails in Finder

I recently upgraded to macOS Monterey (yeah, finally) and immediately noticed that previews of new images weren’t showing up in Finder.

Old images did have a preview image so something was wrong with how previews were generated.

Searching online, I found a few solutions, including one that involved deleting the Finder configuration file (plist file) which may have worked in 2009 or 2012 but that was long ago and it doesn’t work now.

So, to save you doing that and having to resize your favourite Finder windows and configure settings again, the answer is very simple and I found it here.

Load up Activity Monitor and search for com.apple.quicklook.ThumbnailsAgent. Double click on it and force it to quit.

CMD-right click on Finder in the dock and relaunch Finder and your thumbnails should now appear in all their tiny glory.

I’m writing this here because apparently this happens to people over and over again. While it’s the first time I’ve seen this problem it probably won’t be the last.

Your mouse is too small

Prompted by someone sharing this tweet at work I decided to try making the mouse cursor on my machine bigger.

On a Mac go to System Preferences->Accessibility->Display->Cursor.

I only bumped the size up one notch, but it’s made a nice change and really makes a difference to the “feel” of the mouse cursor when hovering over text containing links.

After doing that I wondered what else I could do. I left the display at it’s default resolution but in Firefox I did increase the minimum font size, and that has made some websites more pleasant to use.

My son uses a 15.6″ laptop screen with tiny fonts I can barely read when I’m sitting at his desk. I know I used to do that too in my twenties on a Linux desktop using Netscape Navigator but times change and my eyes change. This blog has been going more than twenty years. I wonder what accessibility features I’ll be writing about in another twenty years, eh?

Putting Accents on Characters on Mac

Accents, everyone has one but some characters have more than one, and writing them on a Mac can be hard unless you know how.

I really only need one type of accent, the “sine fada” in Irish that goes over the vowels. They look like this: á, é, ó, ú and í.

For a long time I used Option-key using an Irish keyboard map I got off Justin Mason years ago. I haven’t used it for some time now and every now and again I wonder if there’s a better way of doing it using the standard keyboard maps on a Mac.

Turns out there is.

This page explains how to use the accent menu, but you can also use “dead keys” to type accents.

The accent menu is dead simple. Press the key down for a little longer than usual and a menu will appear with the accents required. Press the corresponding number and your accented character appears!

The dead key approach is probably faster however. Use the keyboard viewer to see your keyboard layout. I have a large split Microsoft keyboard and I’m using the British PC layout now so when I hit the Option key the accents are highlighted.

If I want to type “I like to eat cake” in Irish, and not “I like to eat shit”, I must use “Option-e” followed by “a” to get “á” in one word:

“Is maith liom cáca a ithe.”

I’m sure by now you’ve realised just how important accents are in daily life. It’s the difference between delicious chocolate and something that looks similar but tastes quite different. Yeah, you really needed that mental image didn’t you? Sorry. 🙂

Rsync between Mac and Linux

99.999999% of my readers can probably ignore this one, but if you are of the small minority who use Rsync and have Mac and Linux computers in your home you’ll want to read this.

I have Plex running on a Raspberry Pi for my music. I have a large mp3 folder. Too large to run Syncthing on it unfortunately, but an occasional rsync is perfectly fine.

I thought it worked fine until I quickly realised it was syncing the same files over and over again. It turns out the Mac and Linux machines I’m using have different ideas about character sets their filenames are stored in. A file with an accented character on the Mac is completely different to one that looks the same on the Linux box.

The solution took a while for me to find but it’s very simple. Rsync has an option named --iconv to convert between character sets!

The solution was embarrassingly simple: Much due to a comment I read when researching the problem, I thought you were supposed to specify the character set in the order of transformation; but it seems as that is not the correct syntax. Rather, one should always use --iconv=utf-8-mac,utf-8 when initialising the rsync from the mac, and always use --iconv=utf-8,utf-8-mac when initialising the rsync from the linux machine, no matter if I want to sync files from the mac or linux machine.

Then it works like magic!

EDIT: Indeed, sometimes, checking the manual page closely is a good thing to do. Here it is, black on white:

--iconv=CONVERT_SPEC
              Rsync  can  convert  filenames between character sets using this
              option.  Using a CONVERT_SPEC of "." tells rsync to look up  the
              default  character-set via the locale setting.  Alternately, you
              can fully specify what conversion to do by giving a local and  a
              remote   charset   separated   by   a   comma   in   the   order
              --iconv=LOCAL,REMOTE, e.g.  --iconv=utf8,iso88591.   This  order
              ensures  that the option will stay the same whether you're push-
              ing  or  pulling  files.

HOWTO: Square Instagram images with white borders

I noticed that a lot of Instagram users, such as Alan Schaller to name but one, were posting images with thick white borders to make their images into the square images that Instagram favours. I like the striking look these images have in the Instagram gallery.

I wondered for some time about the best way of adding this border and from brief searches there are apps that will add the border but my workflow involves Lightroom so I wanted to integrate the border making into my export process.

I work on a Mac, and already have ImageMagick installed so I knew a little shell scripting would probably go a long way.

A couple of searches later, and I found this page describing how to use ImageMagick to create a floating image within a square canvas without changing the aspect ratio of the image.

Instagram resizes to 1080px wide so by using the following code I could make a rectangular image into a square:

convert -background white -gravity center input.jpg \
     -resize 1080x1080 -extent 1080x1080 result.jpg

Here’s an example from my street photo today. See it on Instagram here.

Once I could do that, the rest was simple. I have a Lightroom export for Instagram images that resizes them and places them in a folder where they are synced automatically with my phone using Syncthing.

Export actions have a “post processing” section where Lightroom can call an external script. I created the following script, made it executable with chmod a+x add_instagram_border.sh and added to Lightroom using “Open in Other Application”.

#!/bin/sh

# Square and add white borders to images.
# https://odd.blog/

for i in "$@"
do
    /usr/local/bin/convert -background white -gravity \
        center "$i" -resize 1080x1080 -extent 1080x1080 \
        /tmp/out.jpg
    mv /tmp/out.jpg "$i"
    open "~/Sync/Instagram"
done

The script goes through the exported images from Lightroom, adding borders to them, and then at the end opens the folder in Finder for review.

Hopefully this will be useful to someone else. If you add borders to your images, how do you do it?