From a DM perspective:

1. Let player know that's not what this group is about.

2. Let player know there are at least semi-realistic consequences to simply murdering everything in sight.

3. Apply said consequences.

4. If steps 1 - 3 fail to successfully produce a more positive gaming attitude, eject problem player.

As a player it's trickier but I might discuss with the group before tackling the problem player about it. Or in character demand that they stop being a psychopathic spree-killer and enforce that in game, depends if I know the party will back me and/or I can easily kill them off.