Lots of answers, but the simple, to the point answer is this:
Router == Layer 3 (IP Address) forwarding
Switch == Layer 2 (MAC Address) forwarding
if your Macs (or any IP machine for that matter) are on different subnets, then you need a router.
If you Macs (or any other IP machine for that matter) are on the same subnet, you can use a hub, bridge or switch.
Also, there are translational bridges that allow say Token Ring to talk to Ethernet.