Crontab Not Working in MacOS Sierra

Having used Linux and Unix since 1995, I find myself pretty much locked at the hip with crontab to keep my jobs working on a given schedule.  Go figure, as soon as I update my MacOS machine to Sierra and at the same time want to get Clam antivirus configured to auto-scan, I find out it’s not working in there.  It was a bit of a rabbit hole situation, where one thing lead to another.  In the end, I found out that cron has been deprecated in OS X/MacOS, and now Launchd is default and supported.  One of those things that rubs me the wrong way, but it is what it is since it’s not designed to be a server or a Unix system really.

I found /usr/lib/cron to be symlinked to /var/at, and /var/at has a cron.allow file (/var/at/cron.allow).  ‘At’ is also disabled by default.  ‘Atrun’ controls it.  I vi’ed /System/Library/LaunchDaemon/ and found out that cron was deprecated.

Here’s the skinny on Launchd.  plist files handle the applications that will run within it.  It’s an XML based file which tags a string name for it, the program application that will run, arguments, when it will run, and how frquently.  A description and logs are designated in there as well.  Once one is seen, it’s relatively simple to edit and create your own for any script or application you’d like to run.  That’s what I did.

/Library/LaunchDaemons – holds plist files for global services running as root
/Library/LaunchAgents – Holds plist files only used while users are logged on. (Run as ‘root’)
$HOME/Library/LaunchAgents – Hold plist files used when users are logged on. (run as the userid)

And on to the commands to control launchd… which kinda reminds me of systemd on newer Linux systems, disturbingly.
  • launchctl list – view currently registered plists
  • launchctl load -w <plist file> – adds and registers plist file, starting it.
  • launchctl unload -w <plist file> – remove and deregister plist file.

So, I wanted to have freshclam (clam antivirus script that updates clamav) run regularly.  I created this plist file (/Library/LaunchDaemons/net.clamav.freshclam.plist):

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN” “”&gt;
<plist version=”1.0″>
<string>Checks for and downloads updates to the ClamAV virus database.</string>



And a script I wrote that uses clam antivirus to scan my directories is run by this plist (/Library/LaunchDaemons/net.clamav.clamscan.plist):

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN” “”&gt;
<plist version=”1.0″>
<string>Runs a clamscan on the /Users subdirectories</string>



After all is said and done, Launchd runs clam antivirus to scan my /Users subdirectories on a regular basis just in case I have something on here I shouldn’t.

It’d be nicer if there would just be an integrated scheduler with the Apple clam antivirus that would translate the scheduling into something that wouldn’t require learning how to build a Launchd script from the beginning.  I can see why they didn’t since it started on Linux and it’s easier to just toss something like this into crontab:

*/60 * * * * freshclam 2>&1 > /tmp/freshclam.log


MacOS / OS X – App that makes an app for your scripts

If you’re anything like I am, you have scripts that call do random things, or call other apps behind the scenes to set environments to do other things, etc etc.  The issue I run into is it doesn’t seem pretty to have aliases in my Applications folder.  You can’t set Icons for aliases, and it just sits there as a plain white Icon.  Not cool, man, not cool.  As I was studying Swift code tonight I ran across a gem I thought I’d share which helps amazingly with this problem!  It’s called Platypus, and it creates an app that will run scripts (bash, csh, tcsh, ksh, zsh, Perl, Python, Ruby, Applescript, Tcl, Expect, PHP, Swift, and others) that you set the name for and environment.  Details below.


It’s fairly straight forward, which is nice.  The app name is free form, and so is the author name.  The script path you can type in yourself or find it with ‘select script…’.  If you’re adventurous, the “new” button can be used to create your script right there.
For me, the great part is the interface dropdown which allows you to pick how the called script will be interfaced with.  I pick ‘none’ so it runs in the background out of view.  I have a few ‘wine’ scripts that I call with this, and allows it to run out of sight and out of mind.  As far as icons, I’ve used jpg and ico files by selecting the gear under the picture and choosing ‘select image file…’.  The ones that are able to be used are not shaded out, which is great.

When you click ‘create app’, it will ask you where you want to save it along with the name of the app.  There are other development related selections underneath that can be chosen which I don’t have any experience with.
Screen Shot 2017-07-19 at 9.22.17 PM

I’ve so far used this to call ‘Microsoft Money 2002’ via Wine, along with calling ‘Notepad++’ via Wine.  It works nicely, for me.  It’s available for free (you can donate if you enjoy it) at

The dude made an awesome app.

For those interested, he also makes another app called “Sloth” that acts as a visual version of the cli tool ‘lsof’.  Kinda neat, I just started looking at it about 10 minutes ago.  It’s available off of his main page, just remove “platypus” from the URL and you’ll see links. (or just go to
Kinda neat to immediately see where Google Drive is connecting to, that easily.

Macbook Pro external display only while on battery

I haven’t really done this until now, but I figured I’d share how I worked around my issues.

Since I use my new 2017 Macbook Pro as a desktop & laptop, I don’t want to constantly charge the battery while I have it docked.  The problem is that by default MacOS sleeps when the laptop lid is closed.  This is a problem when you don’t want it open & just want to use an external monitor connected via HDMI (through an HDMI -> USB-C adapter) or USB-C directly.  After searching around for a bit, I found a free utility app that helps with this, named “InsomniaX“.  It doesn’t come in a dmg file, just a heads-up.  It’s packaged in a tar.gz tarball which can be decompressed using archive utility.  That’ll drop it into the same directory as the tarball, and you’ll drop and drop it to your Applications folder.

It’s very spartan and almost invisible unless you’re looking for it.  It sits in the tool bar on top, and looks like a crescent moon.  The drop-down menu appears like this when clicked:
Screen Shot 2017-07-15 at 2.31.29 PM

That pretty much sums it up.  As you can see, I selected “Disable Lid Sleep”, and I am operating primarily on my external monitor as I would when plugged in.  The difference when using the power adapter is there is a selection in the Energy Saver section of System Preferences that reads, “Prevent computer from sleeping automatically when the display is off”.  If desired, InsomniaX also has selections in the Preferences area to disable lid sleep while on AC along with starting the application on login.

Screen Shot 2017-07-15 at 2.43.04 PM

Anyway, it’s a neat little utility and does what it’s supposed to do.  Always nice to share those things when you run across them.  Have a great one!

New Set of Apple Airpods Bluetooth Earpieces

I’ve gone through quite a number of bluetooth earpieces.  The one thing I’ve found though is the quality was always subpar compared to normal wired earpieces, and my guess is due to the amount of power required normally to deliver a decent balanced bass.  The market seemed to have fallen on it’s head, and went the route of creating ear inserts and calling them earbuds.  This doesn’t fly in my world, since my ears hurt after using them along with creating compacted ear wax or even collecting on the earbud itself.  They never quite sounded right since it always seemed like they were intentionally pressed closer to the ear drum.

I decided to splurge and get a set of Apple Airpods since they act as headphones along with microphones.  It did hurt to initially purchase them due to the price being artificially high with Apple not officially selling them at their stores since the stock is severely low.  There was a seller on Amazon, and I ordered through them… for $60 more than MSRP.  After a week or two of use, are they worth it to me?  Yes.

Basically, they feel the same as the stock earpods, without wires attached.  Here is a picture of them with Airpod skins protective wraps along with Spigen brand earhooks covers for use on my motorcycle.  I have to say the Spigen earhooks do a great job of containing the Airpods into my ear while riding.

And this is what they look like without the earhooks, which is how I use them when not on a moving motorcycle.


The reason they have sold themselves to me so heavily after using them is for several reasons.  One is that each earpiece senses when inserted into the ear, and alerts the device it is paired with.  This has been very helpful while listening to music and talking on the phone, since as soon as the earpiece is removed the music application senses the change and pauses as if the headphones were unplugged.  This also is helpful while on speaker – as soon as the bluetooth earpiece is inserted, the phone automatically switches over.  The integration with icloud is awesome, if you use it.  Using icloud, the Airpods can be migrated between iPhone to Macbook Pro to iPad to anything else using icloud.  Once the Airpods are added to one of the devices on icloud, it’s added to icloud and instantly added to everything else while being managed by icloud.  I’ve used this to migrate my Airpods between my iPhone to my Macbook Pro, then back to my iPhone after using them for what I needed.

The ability to switch between earpieces is a nice feature as well, and I use this feature while on long production-related calls now.  Using a single earpiece, Once I notice the battery getting low on power, I pull the other one out of the charging case and put it into my ear.  Then, I put the one I’d been using into the case to charge.  The battery in the case I’ve yet to entirely use through the day, and each earpiece I’ve gotten about 2-3 hours of active use (not standby) from between charge.  I’ve also noticed if used as simply a headset, the battery lasts much longer, usually 4-5 hours.

The container holds the earpieces perfectly, since it’s molded to fit and there is a magnetic holder at the base of the container to pull down and secure them.  This makes holding them in your pocket very stable.  The sticker skin that I have around it is mostly to break up the white color.

Until another business decides to make something that has the same ease of use, quality, and integration, I’d buy this again in spite of it being outrageously priced simply because nothing else offers it that I have seen.

EDIT July 29th 2017
I gotta say, these are my favorite set of bluetooth earpieces I’ve ever owned.  I’ve used them for conference calls, listening to music, listening for notifications while at work, etc.  One of my favorite features is being able to pull them out of my ears on an instant, and the music just pausing.  That’s great at work when someone walks up, and I can pull the earpiece from my ear and talk without fiddling with my phone.  The other thing I love is that I’m able to use them when I ride my motorcycle.  With the Spigen brand earhooks, I’ve been able to ride many times to and from work without the earpieces slipping out of my ears.  Now granted I have a windshield on my cruiser which cuts wind quite a bit, but not completely when at 70+ MPH on the freeway.  Also, the noise cancellation works awesome I’ve found.  You’d think with the microphone (on the bottom of the earpiece stem) being so far from your mouth that it would be a problem, but it does just fine when I’m talking normally to someone and there’s noise around me from others talking in the office.  I’ve used it out of the office too, and I haven’t had anyone have issues with hearing me.  In fact, most don’t think I’m on bluetooth, which in itself means a lot.  When I’ve been on long conference calls, I’ve been using one earpiece, and after 2 or so hours when the charge gets to 30-35% I put the other earpiece in my ear then charge the one I’d been using without any interference with the call.  The earpiece recharge only takes 10 or so minutes, and the charging container lasts for quite a few charges.  I went without charging the container for a week or so, only charging once in its life so far when it reached 40%.

The only complaint I have so far is how oddly my phone won’t connect with the airpods even when they are paired.  I turn off bluetooth and turn it back on, and all is well.  I spoke with an Apple store “Genius” (I hate that term), and she said the same as what I’d been doing.  Not sure why, but it’s a quick fix.

EDIT September 15th 2017
I still absolutely love the quality of the Airpods.  I do think Apple needs to work on the bluetooth pairing detection, however.  One thing I notice quite a bit is how iOS at times detects them immediately and other times I have to manually turn them on in the “settings -> bluetooth” area.  I still notice turning off bluetooth and turning it back on helps at times, so it’s definitely an iOS subsystem quirk that more than likely will be fixed as the audience gets larger.  I thought I lost my main Airpod set because I was in a rush and couldn’t find them in the morning, so I picked up another set at the Apple store. (NOT liking to buy them again, btw).  Ended up finding them at home, so now I have two sets and I’m using one set for my personal phone and the other set for my work phone.  With that being said, I’m using the work cell phone for nearly all work calls now, and it’s amazing during meetings.

How To Make An Extra Disk Partition Remain Unmounted On Boot

After buying another iMac to replace the one that was stolen a while back,  I was setting up the disk partitions and noticed that when I created a recovery partition it would automatically be mounted when the system boots up.  I don’t like this since that means anything could erroneously enter the partition by a simple background oops.  I know Linux/Unix, but the Apple uniqueness made me research for a while.

I’m not going to stretch this out since it’s relatively simple.  Open Disk Utility (Applications -> Utilities -> Disk Utility) then select the partition in question and select the “Info” button at the top.  Copy the Universal Unique Identifier value (the string to the right) to TextEdit or some other note taking utility.

Open Terminal (open spotlight, and type “Terminal“).  Type “sudo vifs“, and you will be prompted for your password.  Type it and once you hit enter a editor will appear.  Press ‘i’ on the keyboard, then enter the following line with your information (replace YOURUUID with the UUID you copied a little earlier):

UUID=YOURUUID none hfs rw,noauto

Press your escape key (esc) and type “:wq” to write and quit.  Once you are back at the command prompt, type the following to tell the system the changes were made:

sudo automount -vc

After a system reboot, the partition will remain unmounted at boot time.

This is how, after creating my recovery partition, I keep it out of sight unless needed.

Bootable OS X El Capitan on USB Stick

With the new version of OS X coming out shortly (El Capitan), here’s a way to make a bootable copy of it to your USB stick.  This process isn’t much different than previous versions, but I figured I’d post the instructions.  This wasn’t created by me, I just copied it from Lifehacker’s website because of the clean 1,2,3 layout already typed up.  Here it is.

The DIY Option: Terminal

  1. Download the El Capitan installer.
  2. Insert an 8GB (or larger) flash drive and give it a name. For this tutorial, we’ll use the name Untitled. Make sure the drive is formatted for OS X Extended (Journaled). If it isn’t, open up Disk Utility and format is so it is. Before you do so, back up any important data on that drive.
  3. Open up Terminal (Applications > Utilities).
  4. Type (or copy and paste) this command into Terminal, replacing Untitled with the name of your drive, then press Enter: sudo /Applications/Install\ OS\ X\ El\ --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ El\ --nointeraction
  5. Type in your password when prompted and press Enter.
  6. Let the command line to its work and don’t interrupt it until you see the final line that says Done. This can take up to a half hour, so be patient.

When it’s done, you can insert your USB drive into any Mac and the launch the installer by holding down the Option key when you boot up your computer.

EDIT June 27, 2016:
If you’ve run into issues with not being able to download El Capitan through the App Store, I ran into that issue today as well.  There are times when the App Store wants to be a complete pain in the butt.  Some people said to log out and try while logged out, and some say to try option-clicking the download button.  I found I had to take a two pronged approach.  I first had to remove all “Install El” directories in different locations, unmounting the flash drive with “Install El” on it, and rebooting.  All of that together fixed everything, oddly.  Thought I’d share.

OS X Yosemite In Bootable ISO format

Maybe you’re something like I am, and want to have a bootable ISO of OS X Yosemite to run under a VM on a Mac. (It’s not going to do very well on it’s own with PC architecture)
Nothing fancy, just an install that you don’t need to bend over backwards and pray to the deity of choice to make happen.  After looking around (since I’ve only really done it directly to USB flash and not to ISO really) I ran across this script made by someone else who wanted the same thing.  I don’t have the URL of where I got it, but I wanted to share.  Keep in mind, you will need to first download Yosemite through the Apple App Store, which will place it in the Applications folder.  Leave it there for the script to do it’s thing.

Just copy and paste this into a script and run it from the command line.  It will make an ISO called Yosemite.iso right on your desktop.  I have an SSD drive and it took approximately 2-3 minutes to complete.  I’m thinking on a regular harddrive with the amount of disk activity it will take longer, but well worth the wait.

Here it is (it’s all there, just not displaying properly.  When you select it all, it will copy fine):


# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ -noverify -nobrowse -mountpoint /Volumes/install_app

# Convert the boot image to a sparse bundle
hdiutil convert /Volumes/install_app/BaseSystem.dmg -format UDSP -o /tmp/Yosemite

# Increase the sparse bundle capacity to accommodate the packages
hdiutil resize -size 8g /tmp/Yosemite.sparseimage

# Mount the sparse bundle for package addition
hdiutil attach /tmp/Yosemite.sparseimage -noverify -nobrowse -mountpoint /Volumes/install_build

# Remove Package link and replace with actual files
rm /Volumes/install_build/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/install_build/System/Installation/

# Copy Yosemite installer dependencies
cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/install_build/BaseSystem.chunklist
cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/install_build/BaseSystem.dmg

# Unmount the installer image
hdiutil detach /Volumes/install_app

# Unmount the sparse bundle
hdiutil detach /Volumes/install_build

# Resize the partition in the sparse bundle to remove any free space
hdiutil resize -size `hdiutil resize -limits /tmp/Yosemite.sparseimage | tail -n 1 | awk '{ print $1 }'`b /tmp/Yosemite.sparseimage

# Convert the sparse bundle to ISO/CD master
hdiutil convert /tmp/Yosemite.sparseimage -format UDTO -o /tmp/Yosemite

# Remove the sparse bundle
rm /tmp/Yosemite.sparseimage

# Rename the ISO and move it to the desktop
mv /tmp/Yosemite.cdr ~/Desktop/Yosemite.iso