Go to File > Build Settings and change "Target Platform" on the right from Windows to macOS X. For Linux, change it to Linux. Save and compile and it'll create a build for that specific platform.
Source: https://docs.unity3d.com/Manual/BuildSettingsStandalone.html