Posts Tagged: Mac OS X


6
Dec 08

Quick tip: Converting DMG to ISO

Save this as dmg2iso and run from the terminal:

#!/bin/bash

if [ -z "$1" ]; then
    echo "Usage: ${0##*/} <file>"
    exit 1
fi

file=${1%.dmg}
hdiutil makehybrid ${file}.dmg -o $file
Like this post? You might also like Coalmine, my centralized error tracking service for your apps. Coalmine captures errors and all kinds of helpful debugging information, notifies you, and makes it all searchable. Check it out!

5
May 08

Color Picker for OS X

This morning I needed to choose a hex color, but I didn’t have easy access to the Color Picker utility in Mac OS X. So I spent about 15 minutes creating a Color Picker.app utility and installed some plugins. Yes, you can install plugins for Color Picker.

Download Color Picker.app here.

Just drag to /Applications/Utilities/ and then you can find the Color Picker in Spotlight.

While you’re at it, make Color Picker more useful by installing these plugins:

Like this post? You might also like Coalmine, my centralized error tracking service for your apps. Coalmine captures errors and all kinds of helpful debugging information, notifies you, and makes it all searchable. Check it out!

14
Apr 08

Using Quick Look from the terminal

Leopard users know how useful Quick Look can be, but using it from the command line is harder than it should be. After looking at other people’s solutions, I decided to write my own.

#!/bin/bash

# ql(1)
#
# Quick Look command for terminal use

if [[ $# -lt 1 || $1 == '-h' || $1 == '--help' ]]; then
  echo -e 'Usage: ql [options] <file>'
  echo -e "\t-t\tForce text mode"
else
  if [[ $1 == '-t' ]]; then
    shift
    qlmanage -p -c public.plain-text "$@" >& /dev/null &
  else
    qlmanage -p "$@" >& /dev/null &
  fi
  pid=$!
  pid_in_use=1
  while [ $pid_in_use ]; do
    pid_in_use=`ps | awk '{ print $1 }' | grep $pid`
    read -sn 1 -t 1
    if [[ $? -eq 0 && $pid_in_use ]]; then # user quit via GUI
      kill $pid
      exit 0
    fi
  done
fi

Besides saving on typing, this script has a few other advantages over the qlmanage command:

  • It automatically returns the command line to you if you close Quick Look with the GUI (after a short delay)
  • You can force plaintext mode for text files that don’t have generators configured (for example, CSS files by default) with the -t option.
  • You can hit any key to close the Quick Look window.

Download ql here.

Like this post? You might also like Coalmine, my centralized error tracking service for your apps. Coalmine captures errors and all kinds of helpful debugging information, notifies you, and makes it all searchable. Check it out!

5
Apr 08

A match made in hell: Windows XP, Boot Camp 2.0, and NTFS

Feel like wasting several hours? Try installing Windows XP with Boot Camp 2.0 (the version released as part of Mac OS X 10.5 Leopard) using NTFS, the file system required for partitions larger than 32 GB. Then watch as it fails miserably, again and again.

Windows could not start because the following file is missing or corrupt:
<Windows root>system32hal.dll.
Please re-install a copy of the above file.

Sound familiar? You didn’t do anything wrong—this is actually Apple’s fault. Hal.dll, the “hardware abstraction layer”, doesn’t have any particular significance; it just happens to be the first file that Windows looks for as it’s loading. Attempting to replace this file with the copy on disk won’t work, and your boot.ini is probably fine.

So how do you fix it, then? The solution is a bit involved, but not too bad all things considered. Here are the steps:

  1. If you haven’t already removed the bad installation, you’ll need to do so. In OS X, open Boot Camp, click Continue, select “Create or remove a Windows partition”, click Continue, and then click Restore.
  2. Create a new partition as you did before, and start the installation.
  3. After the computer has rebooted and it’s booted from the CD, type “R” to go to the console. You should be dumped to the C: prompt.
  4. We’re going to reformat the drive as NTFS ourselves instead of letting the Windows installer do it. Type the following and hit Return:
    format c: /q /fs:ntfs

    Then type this to reboot the computer:

  5. Hold Option after it restarts, then boot to the Windows installation CD again (I believe it boots to the CD by default at this point, but this is just to be sure).
  6. Install to C: (be careful not to select your OS X volume!), but—and this is important—choose NOT to reformat. Leave the file system as is.
  7. Continue the installation process as you would normally.

That’s it! If things went well, the lovely 256-color Windows logo should load and you’ll be looking at Napa Valley in no time.

Like this post? You might also like Coalmine, my centralized error tracking service for your apps. Coalmine captures errors and all kinds of helpful debugging information, notifies you, and makes it all searchable. Check it out!