Ye, that won’t work. It will work after a fashion without the [@cursor], which doesn’t work on pet commands.
Then you will command pet to follow with first line, but second line cant execute until you input the cursor location by left clicking. If you instead cancel by right clicking, it will cancel the second line and cause pet to follow you. Or more accurately, the macro will execute first line if you don’t do anything. So if you click, then just don’t left or right click, the pet will still move to you.
Now, if [@cursor] did work for pet commands, the second line would just cancel the first line every time, and it would just be a pet moveto macro.
But you can do this:
/petfollow [mod:alt]
/petmoveto
That will make the button petmoveto when you press it, and petfollow when you press it with the alt modifier.
You can also add spells to it, since pet commands are not on the gcd.
Here is an example of a macro I used while leveling:
/petattack
/petfollow [mod:alt]
/cast Hunter’s Mark
But you can’t do #showtooltip for pet comands either. But you can find the icon in the list and select it manually.