I use focus to aim my alt's pet. There are probably other ways. I think mine is something like this:

/target Mainguy
/focus [target=targettarget, harm]
/cast [target=focus, harm] petattack

I think the last line would also work if it looked like this:
/petattack [target=focus, harm]

For sure you want the "harm" in there, to avoid the pet picking its own target when you have a friendly target, or no target.