Renaming a Mac hard drive from the command line

You know, if your hard drives are set to show as icons on the desktop, you can rename them by selecting them, hitting Enter, and then typing in a new name? If you want to script naming, you can also name from the command line. For example, if you want to rename the drive you're […]

Modifying the Energy Saver “Put hard disks to sleep when possible” setting using the terminal

If you're looking in Yosemite for where the Put hard disks to sleep when possible setting in Energy Saver lives, it's in /Library/Preferences/SystemConfiguration/, so you can view with the command defaults read /Library/Preferences/SystemConfiguration/ and you'll see the value in "Disk Sleep Timer", with 10 meaning the box is checked and 0 meaning it's not checked. […]

Modifying the Energy Saver “Turn display off after” preferences in Yosemite using the terminal

What's the problem? I'm shocked at how little straightforward documentation there is regarding where the Energy Saver settings (from System Preferences) are stored or how to modify them using the terminal. Where are the settings stored? Using opensnoop, I was able to track down that Energy Saver modifies this file: /Library/Preferences/SystemConfiguration/ The main slider in […]

Terminal command to change a user password on a Mac

Update May, 2019 Now that there are SecureToken users, the command below no longer works to reset another user's password. Thanks to mario on the MacAdmins Slack for testing. Acknowledgements Just a cleaned-up version of directions from Mac Script to change Administrator password Changing a user password via terminal command If you ever want to—perhaps […]

Using OpenSnoop with process names that have spaces in them

opensnoop is a command-line tool that comes preinstalled with Mac OS X allowing you to see what's being modified in your filesystem. If you Google some tutorials on it, you'll see that you can track a particular process name like Safari with code like sudo opensnoop -n Safari but if you try to do it […]

Mac terminal command to disable Java update prompts

If you're using Munki to manage Java updates, even if you're running Autopkg frequently (maybe once or twice a day), it's possible your users may get a Java update notification when launching Java. In other words, you could have Autopkg run the OracleJava8 recipe at 10:00 AM, your user could launch up a Java-based program […]

Configure Mac Remote Management from the Terminal

On a Mac, if you want to remotely manage the client machine using ARD (Apple Remote Desktop), you can go to System Preferences > Sharing > Remote Management. What if you want to configure a user to remotely manage the machine but you have only SSH access (or you want to run a script instead […]

Changing the Energy Saver schedule via the command line on a Mac

You can find a far more comprehensive tutorial at Power Management & Scheduling via Command Line, but if you want to change just the basic options, a command like this should do it: sudo pmset repeat shutdown MTWRFSU 22:00:00 wakeorpoweron MTWRFSU 6:00:00 That's the equivalent of going to System Preferences > Energy Saver > Schedule […]

Running sudo commands in Automator

If you're wondering how to run sudo (for privilege escalation) commands in Automator, this is one way to do it. Launch up Automator (of course). Find Run AppleScript in the library of actions. Then, drag it over to the workflow area on the right. By default, Automator will put in some script structure for you […]