Question is already up… The control at iMac is strange…
Right-click. The mouse can do that badly, have a look after a secondary click. For MC it is best to connect an external mouse with 2 buttons.
Activate the secondary mouse button (right click) in the system settings of your iMac (under "Mouse").
The control of Minecraft under macOS is exactly the same as under Windows & GNU / Linux.
Doors are opened with a right click. If you use a Magic Mouse (2), you have to raise your index finger so that you can right-click (as always, stop).