Please note, these instructions are for OS X Lion.
First, you need to get the IP address of your machine on your local network. In OS X, the easiest place to find this is in System Preferences > Network. If you're using DHCP on your local network, you will want to make sure your computer requests the same IP address when it renews it's IP address lease. I recommend configuring the DCHP Reservation settings on your router to accomplish this. Otherwise, you can specify a manual address in your network settings:
- 
Go to System Preferences > Network
 - 
Click Advanced...
 - 
Click the TCP/IP tab
 - 
Change the Configure IPv4 dropdown to Using DHCP with manual address
 - 
Enter your current IP address in the textbox that appears
 - 
Click Ok then Apply
 
For the purpose of these instructions, let's assume your local network IP address is 192.168.x.x.
- 
Go to Downloads for Apple Developers and download the most recent release of Command Line Tools for Xcode and install it.
 - 
Go to the MacPorts install page, then download and install the Mac OS X Package (.pkg) Installer for Lion.
 - 
In Terminal, run
sudo port -v selfupdate - 
Install dnsmasq
sudo port install dnsmasq 
- 
Add the following line to /opt/local/etc/dnsmasq.conf. (Don't forget to replace the IP address.)
address=/.dev/192.168.x.x
This will point all hostnames ending with .dev at 192.168.x.x. If you'd prefer a hostname extension other than .dev, you can always edit this later and add additional lines. - 
sudo cp /etc/resolv.conf /opt/local/etc/ 
- 
sudo mkdir -p /System/Library/StartupItems/DNSMASQ - 
Create
/System/Library/StartupItems/DNSMASQ/DNSMASQand fill it with the following:#!/bin/sh
. /etc/rc.common
if [ "${DNSMASQ}" = "-YES-" ]; then ConsoleMessage "Starting DNSMASQ" /opt/local/sbin/dnsmasq fi
 - 
Create
/System/Library/StartupItems/DNSMASQ/Startup\ Parameters.plistand fill it with the following:{ Description = "Local DNSMASQ Server"; Provides = ("DNS Masq"); OrderPreference = "None"; Messages = { start = "Starting DNSMASQ"; stop = "Stopping DNSMASQ"; }; }
 - 
Add the following line to /etc/hostconfig
DNSMASQ=-YES- - 
Make it executable
sudo chmod +x /System/Library/StartupItems/DNSMASQ/DNSMASQ 
- 
Open a separate Terminal window and run
tail -f /var/log/system.log - 
sudo /System/Library/StartupItems/DNSMASQ/DNSMASQ 
You should see dnsmasq starting up in the system.log. Make sure there are no errors.
- 
Go to System Preferences > Network
 - 
Click Advanced...
 - 
Click the DNS tab
 - 
Add 192.168.x.x (your IP address) to the list and drag it to the top of the list if you can
 - 
Click Ok then Apply
 
You will need to do this on any device you would like to access your .dev hostnames, including VMWare instances and iOS devices.
- 
dscacheutil -flushcache - 
dig google.com
You should see something like this near the bottom:
;; SERVER: 192.168.x.x#53(192.168.x.x) - 
ping somewhere.dev
You should see something like this:
PING somewhere.dev (192.168.x.x): 56 data bytes 64 bytes from 192.168.x.x: icmp_seq=0 ttl=64 time=0.035 ms 64 bytes from 192.168.x.x: icmp_seq=1 ttl=64 time=0.046 ms