This article explains how to assign the secondary button function on an Apple Magic Mouse. It also contains information on how to enable the secondary button function on the older Mighty Mouse or a generic mouse. These instructions refer to macOS Big Sur (11). However, the procedure is the same or similar in earlier versions of macOS and OS X.
How to Make Your Mouse Side Buttons Work on Mac (Works with Razer Products) – Updated 2023
The Apple Magic Mouse requires OS X 10.6. 2 or later, and the Magic Mouse 2 requires OS X El Capitan (10.11) or later to work properly with a Mac. Other gesture-based mice may require specific minimum versions of the Mac operating system, so check the system requirements for your mouse.
Launch System Preferences by clicking the System Preferences icon in the Dock or by selecting the System Preferences item under the Apple menu.
In the System Preferences window, select the mouse icon to open the Mouse preferences pane.