Disable “Use this disk?” Time Machine prompt

With a diagnostic OS, you’ll likely find yourself mounting many hard drives – either while NetBooted, or booted from an external hard drive. If Time Machine is not enabled, it will offer to backup to any reasonably-sized hard drive connected to your machine.

To disable this, run this command in the Terminal:

defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool YES

This will prevent the Time Machine prompts from appearing.

Tested with: 10.5, 10.6, 10.7, 10.8, 10.9, 10.10

Testing the built-in iSight camera

Sometimes, when building a diagnostic OS, you need to optimize for space – you might be trying to fit the OS onto a small USB flash drive, or you want to decrease NetBoot times.

Once you’ve thrown away the obvious culprits – thanks to something like GrandPerspective – you might decide to trash the contents of /System/Library/Compositions/. I did. Unfortunately, this will break Photo Booth.

We relied on Photo Booth to test the iSight camera, so I came up with an alternative. Save this script as an application and put it in the Dock. Heck, I gave it the Photo Booth icon. It opens a new “movie recording” window in QuickTime Player, but it’s not actually recording. Good for a quick test, and faster than Photo Booth.

Tested with: 10.7, 10.8, 10.9, 10.10

Enabling and configuring NFS

This weekend, I had a need to get NFS working on my Mac. My reasoning? I have a WDTV Live, and found that streaming video through NFS adds less overhead than using (the excellent and free) PS3 Media ServerWestern Digital’s instructions are GUI-heavy and somewhat incomplete, though, so I decided to write my own.

To configure NFS, you’ll need to create a file in /etc/exports:

sudo nano /etc/exports

If the file doesn’t already exist, it should be empty. This file contains your list of shares. Here’s an example of a share from my machine:

/Users/mike/Downloads -ro -network -mask

Breaking it down – first, you’ve got the path to the folder you want to share. Next, it’s set so that anyone connecting has read-only access. And finally, the two last sections detail the IP range that’s allowed to access shares on your NFS server. There are many more options you can add – see this for a full listing:

man exports

Add one share per line. Once you’re happy with your exports file, all you need to do is enable NFS:

sudo nfsd enable

This will start the NFS service and keep it running, even after a reboot. You can also start and stop it on an as-needed basis:

sudo nfsd start
sudo nfsd stop

If you make changes to your exports file, you might need to restart the NFS daemon for your changes to take effect:

sudo nfsd restart

If you’d like to verify that your exports file is properly formatted, this will be useful:

nfsd checkexports

And finally, if NFS is running, you can get a listing of all of your shares (‘mounts’ in NFS terminology) via this:

showmount -e

Hope this is useful to someone! If you’d prefer a GUI anyway, NFS Manager looks to be very well done.

Tested with: 10.7, 10.8, 10.9

Disabling Spotlight

In some cases, Spotlight’s indexing becomes a nuisance at best, and a problem at worst. A diagnostic OS can be used to repair or recover from a failing hard drive, for example, but Spotlight indexing can slow down the process (and lessen your chances of recovering data).

Luckily, it’s pretty simple to disable Spotlight. In the Terminal, run this command:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

If you later change your mind, this command will reverse it:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Note that this disables Spotlight systemwide, not just on a per-HD basis. Existing Spotlight indexes will be left untouched.

It should be noted, in OS X 10.7 and above, the App Store uses Spotlight to recognize which apps are installed and can be updated. With Spotlight disabled, the App Store will only show OS updates. If you’re updating your Diagnostic OS, I’d suggest temporarily changing this setting.

Tested with: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9

Scrolling switcher

Starting with 10.7 Lion, Apple switched the scrolling direction. This can cause some confusion with people used to older Mac OS versions, or those coming from a Windows background.

I wanted to see if it were possible to allow people to toggle this without needing to visit System Preferences, so I did some digging. I found a script for trackpads on Super User, but it used GUI scripting. I modified it for both the mouse and trackpad panes, and posted it to GitHub. Although there are two separate scripts, changing the scrolling direction seems to apply to both the mouse and trackpad.

That said, Charles Edge has posted the best way to do this at Krypted: Disable Natural Scrolling With a Script.

Tested with: 10.7, 10.8

PSU MacAdmins Conference 2012 Presentation

This year, I gave my first presentation at the Penn State MacAdmins Conference: Introduction to Mac Triage and Troubleshooting. Here’s the description:

In this session, we’ll go over the basics of component isolation and hardware/software troubleshooting. We’ll cover common fixes and methods for diagnosing a problem quickly and accurately.

My slides are available here, and the video is below. Enjoy!

Allow admin users with no password to use sudo

Although Apple has always discouraged it, users were able to create accounts without passwords until OS X 10.7. Starting with OS X 10.5, Apple prevented these types of accounts from being able to use ‘sudo’ via the command line.

Why might this be a problem? In my case, I built a diagnostic OS (accessible via NetBoot) that sometimes needed this kind of access. MacPorts was a common issue, but the original reason was a program called CopyCatX. If your user account did not have a password set, CopyCatX would refuse to run.

Anyway, the fix is pretty easy – you’ll need to edit the file /etc/sudoers. Although it’s recommended that you use visudo (as it does sanity checks on the file), I tend to use TextWrangler. Carefully.

Change the line that reads:

%admin ALL=(ALL) ALL

to say this instead:


(I’d recommend against copying and pasting – Bad Things can happen if this file is damaged. Type it out.)

Save. You may need to reboot, as well.

Tested with: 10.5, 10.6, 10.7, 10.8, 10.9

Page 3 of 3

Powered by WordPress & Theme by Anders Norén