Find the most common user on a system

I wrote this shell script for a client that was using JAMF’s Casper Suite.  It is in the form of an extended attribute, but can easily be changed to output as you want.

The script uses the last command to find all the previous logins and then finds the most common user and reports it.  If less than 10 logins have occurred, the script reports the most recent login. Continue reading


Control if a window opens when a volume mounts

This may not be as applicable anymore with Mavericks and the new createinstallmedia command, but it was relatively common to make a copy of the OS X Installer media onto a firewire or USB drive to allow for faster installs than from a CD or DVD.

One issue with this was always that when the drive is mounted, the Finder would open a window to show the installer.  This was fine if there was only one volume on the drive, you probably wanted it open, but often a drive would have multiple installer partitions and a few bootable partitions and maybe a data partition as well. We don’t want any of that to open automatically. Continue reading

Get the path of file onto the clipboard

I find myself needing the path to a file relatively frequently to add to an email or documentation.  I added a service to the Finder contextual menu to get the path to the selected item.  This service notifies me with an alert (just for fun) and can be invoked with a keyboard shortcut.  This was done in Mavericks (10.9).  Most of it should work in 10.8 or 10.7 (except the notification). Continue reading