Automatic Mount Monitor script for macOS

Hope this helps someone: I have an issue where Cryptomator sometimes dismounts so I wrote an Applescript to warn me via a Pop-up window which I can’t miss if the drive is not mounted.

I run the script automatically every 1 minute using a custom macOS launchd agent like this:

Open Apple’s editior in “/Applications/Utilities/Script”

Copy and paste the below script and save it someplace naming it: “cryptomatorMountChecker.scpt”

Remember the path.

# set diskName to the Cryptomator mounted volume (/Volumes/<mountpoint>) you'd like to monitor
set diskName to "_cryptomator"

tell application "System Events" to set diskNames to name of every disk

if diskName is in diskNames then
	#display dialog quoted form of diskName & " is already mounted." & return buttons {"OK"} default button 1
	#do shell script "open /Applications/"
	display dialog quoted form of diskName & " is no longer mounted!" & return buttons {"OK"} default button 1
end if

Then create a Launchd Agent like so:

cd ~/Library/LaunchAgents/

vi cryptomator.mount.monitor.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
    <string>Cryptomator Volume Mount Monitor</string>

Save the file and now from Terminal run:

launchctl load ~/Library/LaunchAgents/cryptomator.mount.monitor.plist
launchctl start cryptomator.mount.monitor

You’re all set. Eject the drive in Cryptomator, wait 1 minute and you should see a pop-up informing you. Mount the drive once more and no popups.



That’s quite a creative approach, thanks for sharing. :slight_smile: Just wanted to let you know that the disappearing volume is a WebDAV bug in Finder of macOS High Sierra. It has been fixed by Apple in macOS Mojave. Another “fix” will be the FUSE integration of Cryptomator 1.4.0 that’s currently being worked on. You can get a sneak peek by downloading Cryptomator 1.4.0-beta3 but be aware that it’s not a stable release yet.

Thanks. I ran with your sugestions with the beta verson and FUSE for Mac successfully and upgraded happily to Cryptomator 1.4.0 since its release with no errors.

VIM is able to create its .<filename>.swp files without error.

One thing I have noticed though - markdown editors such as & iA Writer state early on that the file system cannot support their builtin version history support. Not sure how they achieve this but is this limitation imposed by the FUSE file system perhaps?