Finder Sucks at SMB Shares, Here's How I Fixed It

Posted: January 13, 2020

I mean, I didn’t fix Finder. There’s some problems that are too much of a dumpster-fire even for me. But I did fix this issue.

Success

This worked extremely well. Time will tell if it works long term but the initial results are extremely promising. Here's hoping the developers of this app can stay ahead of Apple's ongoing lockdown of MacOS.

1 Week Update: I haven't hard to hard-cycle my Macbook since this was setup, not even a single time. I think it's safe to call this a successful fix!

1 Year Update: I ended up letting my subscription to this software expire, as Apple seems to have fixed the underlying issue.

So recently I had an issue with my otherwise stellar Mac, and as is often the case, it was with the Finder. I use SMB shares for pretty much everything both work and home, and if you leave an SMB share connected to your Mac when it goes to sleep, oh you. You will suffer the wrath.

In my case it meant usually the Mac was a little unstable after I booted it back up, or worst case, I’d have to physically remove the Macbook from my Henge Dock and restart it manually with the power button. Not to mention the fact that, as a person, I find it ridiculous when I have to do things that are repeatative and simple. When I’m faced with these tasks, I don’t want to do them, I want the damn computer to do them.

I wanted a way to disconnect these troublesome shares when the Mac goes to sleep, but of course, MacOS doesn’t let you do that out of the box. Fortunately I found an app called PowerManager, sells for $12.95 USD, that seems to be able to do the job, despite Catalina being more cagey than ever about things like system state. (Also you can try this before you buy it, so don’t stress the price. I haven’t actually bought it yet but fully intend to since it solved this issue for me.) Ok, now it’s just a matter of the script itself.

Simple but effective UI is my favorite, to be honest.
Simple but effective UI is my favorite, to be honest.

For my purposes, I didn’t want to just unmount everything in there, since I occasionally leave flash drives plugged in, and there’s also my Bootcamp volume and Time Machine disks. So, with that in mind, I decided it made more sense to specify the names of my Windows Shares that I usually connect to in an array, and iterate through them to do umountings where needed.

I added this script to my account’s scripts folder, named sleep.sh. Seemed logical enough:

#!/bin/bash

declare -a paths=("/Volumes/Projects"
		  "/Volumes/www"
		  "/Volumes/scripts"
		  "/Volumes/Software"
		  "/Volumes/Shares"
		)

for p in "${paths[@]}"
do
	if [ -e "$p" ]; then
		sudo umount $p
	fi
done

exit 0;

And then I fired up a couple of these, put my Mac to sleep, and voila. Resumed from sleep, no shares connected, and Finder wasn’t smelling toast.