Skip to content

macOS

Go old school Terminal for stock quotes

My main machine is still running Mojave, and will be for some time—our accounting app and my scanner both rely on 32-bit code. For a very long time, I've been using the built-in Stocks widget from the Dashboard (something else that's gone in 10.15) to track stocks I own or am interested in following.

I have two displays, so I just dedicate a small corner on one of them for the Dashboard widget, which I detach from the Dashboard using an old but still functional Dashboard devmode hint. The Stocks Dashboard widget is quite narrow, and not all that tall, so it didn't take a lot of space.

But recently, it broke, as you can see in the image at right. I set out looking for a replacement—just a simple desktop app that would open a window with stock quotes. Apple's own Stocks app doesn't meet my needs—it has a huge News area you can't close. Similarly, the Stocks section of the Today area in Notification Center requires mouse movement and action on my part to see.

I took a look at any number of third-party apps, but all of them were either full-blown stock traders/managers, lived in the menu bar or Dock, or were discontinued. I finally found what I was looking for, not in a desktop application, but in mop—an open source Go program—running in Terminal.

After a bit of setup work, here's what I'm now seeing1While I wish I had bought a lot of these years ago, I didn't—these are just some sample stocks on my desktop:

Yes, the window is slightly wider than my old one2It's actually incredibly wide, but I don't need to see the other columns, but it's not as tall, and I was able to find a spot for it. If you'd like to try mop yourself, setup is relatively simple.

[continue reading…]



How to upgrade a web host’s command-line PHP

The following is a very geeky, very niche1Where 'niche' is defined as 'of interest to maybe one person' tip, and I'm only documenting it here because it took me a while to figure it out, and I'd like to not have to go through that again if the need arises.

This site, and a few other personal projects, are hosted at Ionos, with whom I've been generally happy. On the web/GUI side, Ionos makes it really easy to control which version of PHP is used on your sites.

But I also have command line access to my server there, and I ran into an issue trying to run a PHP script (to upgrade another site). It threw an error, so I thought I'd check which version of PHP was in use…

$ which php
/usr/bin/php
$ /usr/bin/php --version
PHP 4.4.9 (cgi-fcgi) (built: Aug 29 2019 12:59:15)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

PHP 4.4.9 was discontinued in 2008—no wonder the script threw an error!

[continue reading…]



Send URLs to a video download app via Automator

When I find things I enjoy watching on YouTube, sometimes I want to download them—because they may go away, or I may want to watch offline. There are any number of tools out there that will do this for you, including web sites and Mac-specific apps. On the Mac side, I had been using 4K Video Downloader, but recently found VIDL, which had one big advantage for me: It comes with a Safari toolbar icon.

When I see a video I want to keep, I click the VIDL toolbar button, and VIDL launches and downloads the video. (Because it's based on the open source youtube-dl, VIDL supports a lot more sites than does 4K Video Downloader, which is also nice.)

But recently, I noticed that some of the videos I downloaded with VIDL were at 640x360 resolution, even though the source on YouTube was at least 1920x1080. I tried those same URLs in 4K Video Downloader, and I was able to download the full HD versions. There aren't many settings in VIDL, so I didn't see any obvious way to force it to get higher resolution versions1youtube-dl is supposed to get the highest-resolution version automatically, so I switched back to 4K Video Downloader…but I really missed the handy toolbar button.

It's not like it was a lot of work to copy a URL, switch to 4K Video Downloader, and paste, but it was just enough work to get annoying. If I had the skills, writing a basic extension like this for Safari should be pretty simple. But as I don't have the skills, I went looking for another solution, and I found one using Automator:

I created a new Service in Automator that sends URLs to 4K Video Downloader via the contextual menu in Safari's URL bar.

[continue reading…]



Living the bifurcated life in macOS Catalina

If you're a macOS Catalina user, and a user of Terminal for various tasks, you might be surprised at how some things work—or rather, don't work, in Catalina. As a first example, consider the Utilities folder…on the left is how it appears in Finder, and on the right, the contents of that same folder listed in Terminal:

While Finder shows a full Utilities folder, Terminal shows it as empty. Why? If you're somewhat familiar with the technical side of macOS Catalina, you probably know the answer: Apple has separated much of the OS and placed it on a read-only volume.

Apple's "About the read-only system volume in macOS Catalina" page explains things fairly well—basically, what you see as one Utilities folder in Finder is really two things: A read-only Utilities folder, and a user-writable Utilities folder. (If my machine had any user-installed apps in the Utilities folder, they would have shown up in the Terminal output above.)

[continue reading…]



How to securely hide worksheet(s) in an Excel workbook

Important note: Please see the comments—the method I discuss here is secure from casual users. However, the Excel files are just zipped XML files, so it's possible to unzip them and open them with a text editor. When I tested with my dummy salary worksheet, I could see individual salary values, but no actual text—so there wasn't any way to associate a salary with a person. Still, the following should be considered as only a semi-safe solution.

My wife wants to create a budget spreadsheet for the various departments in her company to use. Each department would have their own tab, showing their planned yearly budget by month for the coming year. A super-simplified and unrealistic input worksheet might look like this:

The green areas are the portions that the users would fill out—probably not the department heads, but just someone in the department. Which leads to the problem: There's a worksheet called Salary Info that's used to populate the Salaries line in the workbook. (In my silly example, I just divided the total salary into four equal quarters.)

The problem is that the Salary Info worksheet contains salary information for the entire organization, and this isn't information that should be shared with everyone.The Salary Info sheet might reveal, for instance, that a coworker is leaving in three months—the coworker has told management, but the employee isn't ready to tell the entire company just yet.

So how can you distribute the workbook to all the departments, with the salary info intact, but without revealing that data to everyone?

[continue reading…]



See exactly when an app launched

Update: I guess I should have searched here before I posted this—I wrote up another solution a few years ago, and that one includes a Keyboard Maestro implementation. Whoops! As this one's another method, though, I'll leave it up.

I was working on some stuff for our upcoming Usher 2 release, and needed to know how long Usher had been running. A quick web search found this post, where one of the comments had an answer that works well in macOS:

ps -p pid -o lstart=

Replace pid with the process ID (PID) from ps -ax for the app or process in question, and you're done. But it's possible to make it even easier to use by automating the task of getting the process ID. Here's what I came up with:

ps -p `ps ax | grep [U]sher$ | cut -c 1-5` -o lstart=

The bit between the backticks gets the matching process line from ps, then uses cut to keep just the first five columns, which contain the PID.1When the shell encounters backticks, it processes the commands within those backticks before processing the rest of the command—in this case, the backticked command returns the PID.

[continue reading…]



The 2020 edition of my Excel run tracking workbook

At the end of 2016, I first posted about my run tracking Excel workbook. That first version was crude, but functional, and I used it to track every mile of my "2,016 miles in 2016" running goal. I posted a minor revision for 2017, then made some major updates for 2018. When 2019 rolled around, I made a few more changes, which I released by way of a note added to the 2018 post.

Now that 2020 is here—I know, it's a bit past January, sorry!—I've made yet more changes, and have decided it's time to replace both of the previous posts with one new all-in-one post. Here you'll find a link to the latest version of the workbook, as well as full instructions on how to use it.

[continue reading…]



Quickly create a nested folder structure via Terminal

Have you ever needed to create an empty folder structure with many levels of repetitively-named folders? This doesn't happen a lot, obviously, but if you try using Finder for this task, you'll quickly discover it's really tedious. But a quick trip to Terminal makes the task very fast, and it's not overly complicated.

Let's say you need a folder structure to handle reports that you'll be receiving weekly, but need to keep track of over both quarters and years. One way to handle that would be with a folder structure like this:

(Hopefully obviously, the same structure repeats within each separate year's folder.) Creating that many multi-leveled folders in Finder would be time consuming and tedious. But in Terminal, you can create the entire structure with just one command:

mkdir -p 202{0..5}/qtr{1..4}/week{1..13}

That command takes under a second on my iMac to create the entire directory structure (over 330 folders). Zoom! So how does this work?

[continue reading…]



Add metadata to ripped movies and TV shows

Somewhat regularly, I write about ripping DVDs and Blu-Rays. I tend to prefer physical media and sometimes—especially when buying an older TV series or classic movie—the disc won't include a digital copy. So I rip the disc—this way for Blu-Rays, or just via HandBrake for DVDs—to create my own digital copy.

Once ripped, the problem is that I have a video file that will play, but that has no useful information about what the video is—no metadata about the cast, production year, or (for TV series) season and episode. If I try to add the movie to the TV app (or iTunes, as on my iMac), it will require some hand editing to wind up in the right category, and it still won't have any show information.

Enter Subler, a free app to help you "tag" (add metadata to) movies and TV shows. There are probably other apps out there that do this, but Subler works quite well for me, especially for TV shows.

When I rip a TV series, I'll give the files a filename based on its title and (for TV series) season and episode, like Wings S01E01, or Sports Night S02E04. I then drag and drop the ripped file onto Subler's dock icon, and it opens a window, showing all the metadata associated with the file; here's how the window looked after I ripped the first episode of Sports Night:

[continue reading…]



How to fix Split View in macOS Mojave and Catalina

macOS has had (since 10.14) a built-in Split View mode that lets you use your full screen to display two apps side by side, each in a quasi "full screen" mode. Personally, I never use this feature—why limit yourself to just two windows?—but I know many people do.

In macOS Catalina, you activate Split View via a green button hover, which then shows this pop-up menu:

The activation method is somewhat different in 10.14, but the end result is the same—a window taking up half your display. Except when it doesn't…

As you can see, the full screen menu item works, but the two Split View entries do nothing at all—no error message, but nothing happens other than the menu vanishes.

[continue reading…]