Mac Tips

This page is a collection of various Mac OS X tips that will come in handy at some point or other.

Flushing the DNS Cache

Sometimes, you may find that the IP address for a certain DNS domain name has changed, but your Mac still seems to be trying to access the old IP address. This can happen because Mac OS X keeps an internal cache of various directory service queries. DNS lookup is one such type of query that gets cached. Here’s how to flush this directory service cache:

dscacheutil -flushcache

Changing Printer Passwords

This is particularly for changing of SMB (Windows) printer passwords that have been configured into your Mac OS X. If you ever have to change your Windows passwords, the passwords you have saved into your printer configuration will be outdated. Short of deleting and recreating your printer passwords, here’s how to update it.

  1. Edit /etc/cups/printers.conf (in a Terminal window, type: sudo vi /etc/cups/printers.conf).
  2. Change every occurrence of your old password to your new password. Here’s a handy vi command to use: :g/oldpassword/s//newpassword/g
  3. Save the file. The vi command to do this is: :wq
  4. Restart the printing service: sudo killall -1 -c cupsd

I would not be surprised if there was a more elegant GUI way to get this done. But I don’t know, and I am a command-line UNIX kind of person, so this works for me.

Speed Up Dock Auto-Hide/Show

There are some apps I use that need too much screen space, and the dock at the bottom gets in the way. I ended up auto-hiding the dock. But I find the auto-show too slow. Here’s how to speed it up:

defaults write autohide-time-modifier -float 0.15;killall Dock

Clear Recent Searches in Safari

Run this in the terminal: defaults delete RecentSearchStrings

Debugging Tips

The equivalent of strace or truss in Mac OS X is dtruss.

Last modified: February 3, 2012

One Response to Mac Tips

  1. Thanks a lot for the printer password tip! The 6-month policy on campus has me struggling twice a year with the printer re-configurations. This is so much easier! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.