Category Archives: System Tools

Deleting/viewing mail in postfix queue (mailq)

Postfix stores mails in a queue before sending it. Postfix has a command line called ‘postsuper’ which can be used to delete unsent mail from the queue. Before removing mail from the queue it is good idea to list all mail in the queue.

List all of the mail which is in the queue.


View the contents of a specific message.

postcat -q MESSAGE_ID

Remove a message from the “mailq”.

postsuper -d mailID

where mailID is the ID of the mail in the mail queue.

Delete all queued mail from the mailq.

postsuper -d ALL

Enable mounting of remotedisk remote CD/DVD on any unsupported mac

If you are like me, and your CD/DVD has stopped working on an old mac, you can use CD/DVD sharing to access the drive on another computer. Unfortunately, if your old computer originally had a CD/DVD drive then this feature is disabled by default. You can execute the following commands in terminal to enable Remote Disk.

$ defaults write EnableODiskBrowsing -bool true
$ defaults write ODSSupported -bool true

Restart your computer and then you’ll see the Remote CD/DVD under devices in the Finder’s sidebar.

Use terminal to delete all hidden files on a mac

I recently came across a client’s computer that had a tremendous number of hidden files that were causing problems. I tried many different ways to delete these, unsuccessfully. Unfortunately, there were about 80,000 hidden files nested within hundreds of directories. Here is the code that I used to delete them:

First cd to the root directory where you want to start deleting. Then execute the following code:
find . -name "\._*" -type f -delete

Most of the hidden files will start with ‘._’ but some may still remain. For me it was .DS_Store and .FBCLockFolder. To delete these, I executed just searched using the finder by selecting ‘other’ in the search criteria and scrolling to visibility. Then select invisible. Make sure the search scope is only in the folder you want to search. Then just select all and delete.

Mac OS X Lion: Install Failed – Disk is Damaged

If you get this message, then your hard drive needs to be repaired. This can be difficult to solve because data may not be backed up and disk utility may not be able to repair your drive. Furthermore, our recovery options are now limited since we can’t buy Install DVD’s anymore. To make matters even worse, the installer creates a perceived loop that will not allow canceling installation or access to disk utility, terminal, or other options.

Here are the steps I followed to solve this issue:

  1. Try installing Lion and get ‘Install Failed – Disk is Damaged’ error
  2. Reboot computer and try installing again – same error (continued reboots do not allow access to install options, disk utility, or terminal; only reboot option)
  3. Reset PRAM to get out of infinite loop (rebooting, attempting to install, failing, …)
    • Turn off computer
    • Locate the following keys on the keyboard: Command (⌘), Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    • Turn on the computer.
    • Press and hold the Command-Option-P-R keys before the gray screen appears.
    • Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    • Release the keys.
    • Now computer should boot normally into the installer
    • For more information, see Apple Support Article About NVRAM and PRAM
  4. I downloaded an installer image from the internet to perform my install. I then used disk utility to copy the files to a flash drive. To boot from this drive, I held option as my computer started and selected this drive. If you don’t have a bootable flash drive, then boot from any installer DVD that you do have.
  5. Go to the Utilities menu and select ‘Disk Utility’
  6. Try to repair the disk here. It may not work. If it doesn’t, then close Disk Utility and open Terminal
  7. When terminal opens, type fsck_hfs -rf /dev/disk0s2 and press return
  8. This may take up to 10-15 minutes, but it should repair your drive. When it is complete, restart your computer and try the installation again. These steps worked for me on a MacBook Air Original. NOTE: your drive may not be disk0s2, so if it is not, then try to lookup the actual drive path in Disk Utility or search on Google.

Mac OS X (10.6, 10.7, 10.8) Disk Utility repair failed

If Disk Utility is unable to repair hard drive, then try booting from any install DVD or USB drive. Then open terminal from the Utilities menu.

When terminal opens, type:
fsck_hfs -rf /dev/disk0s2

Your disk partition may be called something other than ‘disk0s2’. This process may take 10-15 minutes, but is more powerful than the regular Disk Utility repair option.

Disable Automatic Restart after Windows Update – Windows XP

Go to registry editor and navigate to the following registry key:
If the key does not exist, then you must create it.


Change the “NoAutoRebootWithLoggedOnUsers” DWord value to the required number.

0 = False (Allow auto-reboot)
1 = True (Disallow auto-reboot)

Save and restart Windows Operating system.

Create your own system recovery dvd/cd to restore your system

The best program I have found to make your own Recovery DVD is Macrium Reflect. There is a free version available with all the necessary features.