Skip to content

Mac OS X Hints

Reverse a video using ffmpeg

This post is another in an ongoing series where the sole point of the post is to make it easier for me to find this information in the future—instead of searching sites and finding tons of wrong answers, I can just search my blog and find the right answer. If it's useful to anyone else, that's a bonus.

Sometimes, I want to reverse a video, usually for humorous effect—to turn a disassembly time lapse video into an assembly time lapse video, for example. If you have ffmpeg installed (via Homebrew or MacPorts or other method), then it's quite simple to do. Here's the command:

ffmpeg -i original_movie.mp4 -vf reverse -af areverse new_reverse_movie.mp4

It doesn't have to be an mp4, of course—any format that ffmpeg can deal with will work fine.

(I originally found this solution on StackExchange.)



Search sites from anywhere via shortcuts, version 3.0

Yes, it's the return of the return of Web Search via Shortcuts, now at version 3.0 and much better than either of the previous versions. This is my Keyboard Maestro macro that lets you easily search web sites via a pop-up menu and an abbreviation:

The above would search DuckDuckGo for the theory of everything, and open the results in your default browser. Here are the highlights of the 3.0 release:

  • The input dialog appears much more quickly—over 4x faster than in the 2.x series.
  • All customization is done within the macro itself; there's no need to muck about in the Keyboard Maestro editor.
  • You can modify (shortcut, description, URL) any search site, including the default sites.
  • A list of 80+ search sites is included, and you can activate any of them with a few clicks and the creation of a shortcut word for each site.
  • All updates are tracked in two small text files on your drive, which means future updates will be completely automatic.

Read on for the details, or if you'd like to get started with Web Search via Shortcuts version 3, download the macro now. (Current users can use the check for updates macro to download the new version directly from version 2.x.)
[continue reading…]



Convert epoch time to human-readable time in Terminal

This is a stupid-simple Unix tip, posting more as a reminder to myself than anything truly insightful—I keep forgetting these details, so by doing the work to create a post about it, I'll never forget them again…

I've been using unix time from the unix side of macOS quite a bit lately, as it's an easy way to get timestamps for things. Getting the epoch time is easy:

$ date +%s
1641735529

The thing I always forget is how to convert an epoch time back into a human-readable format of my choosing, despite it being shown in the man page. It's simple; use the -r option, like this:

$ date -r 1641735529
Sun Jan  9 05:38:49 PST 2022

And, of course, you can format it how you like using a strftime formatted format string, i.e.

$ date -r 1641735529 "+Today is %A, %B %e, and it's %I:%M:%S %p"
Today is Sunday, January  9, and it's 05:38:49 AM

Related: Yes, I wake up early; it started with macosxhints.com and needing to update the site before I left for my real job each day, and it persists 20 odd years later.



Search sites from anywhere via abbreviations

Note: This post is no longer updated. Please see the version 2.0 post for current details and download links. This post remains because it has a fair bit of information about the macro in general.

Nearly five years ago, I wrote about my simple Keyboard Maestro web search macro that let me search many web sites from anywhere within macOS. While it worked well, it felt a bit cumbersome—I had to scan a pop-up palette of sites, and then press the proper key to select the site I wanted to search (so I had to keep the list relatively short). Then I'd wait for a new prompt to appear, type the search terms, and press Return.

Because of my macro's convoluted interface, I found myself using our own Butler most of the time, as it offers an interface similar to SafariKeywordSearch (which works in Safari as an extension; I was reminded of it due to a recent post by @danmoren on Six Colors). Both it and Butler do keyword searches, so you can type d best home vacuums to search DuckDuckGo for best home vacuums, or gm Tokyo to search Google Maps for Tokyo.

I decided to rewrite my macro to work like those apps do, but with an added feature: I use a number of browsers, and there are times I want my search to run in something other than the default browser. Using my rewritten macro, I can now optionally specify a browser in which to run the search. So when I activate the macro, I can use one of two different formats for the search command:

Both of those searches will search the Apple Movie Store for movies with the keyword disaster; the one on the left will use my default browser (currently Safari); the one on the right will use Edge.
[continue reading…]



Simplify VPN connections via TunnelBlick

I use a VPN on our home router, which runs pfSense. When I'm on my laptop, I connect to the VPN for two reasons. The first is security when using unknown wifi connections. The second is for ease of access to my home Macs and network—when on the VPN, my laptop appears as part of the local network, so screen and file sharing are simple and 100% reliable.

To access the VPN, I use TunnelBlick, which runs as a menu bar application. Launch the app, activate its menu bar item, choose your VPN connection profile from the list, enter your password, and you're connected. But doing this several times a day gets annoying quite quickly. Thankfully, TunnelBlick includes AppleScript support.

Using that support and Keyboard Maestro, I wrote a few macros to simplify connecting to and disconnecting from our VPN, as well as changing the DNS address depending on whether I'm connected to the VPN or not.

Technically, the DNS address shouldn't have to be switched—I have the VPN and Tunnelblick configured to automatically switch on connect, but for whatever reason, it's just not happening. So I included DNS address switching in my macros.
[continue reading…]



VMware Fusion and the vmmon broken pipe error

As part of my struggles to fix my constantly-crashing suggestd process (and the Spotlight failures that it seems to cause), I reinstalled macOS Mojave a couple of times using the Internet Recovery partition. These were in-place reinstalls, so I didn't start completely clean, but the OS is reinstalled from scratch—so much so that I even had to run the 10.14.6 updater and a couple of security updates again.

In the end, not only did this not fix the suggestd problem, but it also broke my all-important VMware Fusion virtual machines. When I tried to launch any of them, I was greeted with an error message:

Error: Could not open /dev/vmmon: Broken pipe

This is apparently so common that VMware has a knowledge base article on the issue. The error is due to VMware Fusion not loading its required kernel extensions, but nobody seems to be sure of the cause of the problem. However, that article is supposed to fix it…unfortunately for me, it did not. I never saw an entry in the Security & Privacy System Preferences panel to allow VMWare's extensions. As a result, they didn't load.

Here's the tl;dr for the fix that did work: Rebooting in Recovery mode (hold down Command-R at startup) and deleting the KernelExtensionManagement folder located in /private/var/db. There was a lot more to it than that, though, which I cover for my own possible future needs in the rest of this post, in case the linked sources ever vanish.

[continue reading…]



Remove tracking data from copied URLs

A while back, my friend James and I were discussing the amount of tracking cruft in many URLs. In my case, I subscribe to a ton of email newsletters, and I noticed that those URLs are just laden with tracking information—and most go through a URL processor, so you don't really see those tracking details until you've clicked the link, at which point it's too late to avoid any tracking.

I wanted a way to clean up these URLs such that the least-possible tracking information was sent to a server—and in particular, to prevent any browser cookie creation. In addition, if I want to share a link with friends, I don't want to send them a crufty tracker-laden link—I wanted a nice clean shareable URL.

Note: I wrote all of this before I knew about Jeff Johnson's Link Unshortener, which does all of this (and more) in a "real" app. If you'd like the easy solution, Jeff's app is the way to go. Mine is definitely a do-it-yourself concoction that's not for the faint of heart.

tl;dr version: Install this macro group (v8.3) in Keyboard Maestro to remove tracking details from copied URLs in a set of defined apps.

Latest Update: Apr 11 2022 Fixed a bug related to custom domains, added aliexpress as a decrufting URL, and updated the in-app help boxes.

Going forward, all future updates to this macro will be found in this post on the Keyboard Maestro forums.

[continue reading…]



Fix a “could not complete your purchase” App Store error

I've been having an odd issue with the Mac App Store app on my Mojave-running iMac: Sometimes the App Store app will fail to install an update for some app. When that happens, I see a dialog with this text as the title:

We could not complete your purchase.

Below that is a single word, "cancelled," and that's all. Searching the web, I came across this thread on stackexchange.

What finally worked for me was a combination of things listed there—none of these steps on their own seem to fix the problem, but all together do, at least until it occurs again.

  1. Quit the App Store app.
  2. Switch my DNS to another provider.
  3. In Terminal, paste this command and press Return:
    open "$TMPDIR/../C/com.apple.appstore/"
  4. Confirm that the Finder opened a window to the com.apple.appstore folder, then drag everything there to the trash.
  5. Back in Terminal, paste this line and press Return: killall -9 appstoreagent
  6. Relaunch the App Store app.

This method has worked for me each time I've had this issue. It's annoying that it keeps recurring, but at least the fix is relatively simple.



Copy links in Chrome, Firefox, and Safari in one step

Something I do a lot is copy links—whether for articles here, or for pasting into Messages or Signal or Twitter, or for corresponding with Many Tricks' customers, I copy a lot of links.

Web browsers—at least the "big three" of Chrome, Firefox, and Safari—bury their copy link commands in a contextual menu. If I want to copy a link, it's a right-click and then either using the keyboard (press C then Return in Chrome and Safari) or mouse (Firefox) to select then activate the Copy Link command.

If you use Chrome or Firefox as your browser, you're in luck: You can install a simple extension in each that lets you copy a link by simply hovering over the link and pressing Commmand- or Control-C:

Now, about Safari. I couldn't find a Safari extension to handle this seemingly simple task, so I turned to Keyboard Maestro.

[continue reading…]



Simplify updates to oft-updated text documents

Here on my blog, I've been tracking macOS release dates and rates for nearly 15 years—if I'm doing my math right, I've edited and republished the post 115 times since then. Until the most recent update, all 115 of those updates were pretty much done like this:

  1. Update a Keynote document that calculates the release rate data and contains the two charts in the blog post.
  2. Edit the text of the blog post in a text editor, with Keynote visible, replacing all instances of variable data—dates, numbers, size, rates, etc.—wherever they appear.
  3. Upload the graphs and publish the updated post.

While this isn't an overly complex task by any measure, the second step in particular has gotten more time consuming over the years, because of the length of the post: It now contains over 50,000 characters. That's lots of scrolling and looking for the few bits that change—and I'd often miss a date or a number in some portion of the post.

I thought there had to be a better way, and there is…and of course, the better way uses BBEdit. In particular, BBEdit's support for including one file in another—and using variables in the included file—makes my update task much simpler. If you have text files that receive regular updates, you may find this method of interest, as it can be a big timesaver.

[continue reading…]