Serve different files depending on OS/Browser

The following will help you identify both the OS and the Browser and add classes to the body tag that you can reference when loading the page. You could modify the whole process so that it determines which download link to use. This is what I’ve used for CSS differentiation purposes, but ultimately what you want is the identification of the OS.

strtolower( $_SERVER['HTTP_USER_AGENT'] ); identifies the browser being used.
getenv( 'HTTP_USER_AGENT' ); gets the environment/OS.

<?php 
function os_browser_body_class( $class ) {
        $brwsr = array(
            'msie',
            'firefox',
            'webkit',
            'opera'
        );
        $os = array(
            'Windows',
            'Mac', //will include Mac OS & Apple iOS
            'Macintosh' //just Mac OS
        );
        $user_brwsr = strtolower( $_SERVER['HTTP_USER_AGENT'] );
        $user_agent = getenv( 'HTTP_USER_AGENT' ); 
        foreach( $brwsr as $name ) {
            if( strpos( $user_brwsr, $name ) > -1 ) {
                $class[] = $name;
                preg_match( "https://wordpress.stackexchange.com/" . $name . '[\/|\s](\d)/i', $user_brwsr, $matches );
                if ( $matches[1] )
                $class[] = $name . '-' . $matches[1];
                return $class;
            }
        }
        foreach( $os as $name ) {
            if( strpos( $user_agent, $name ) > -1 ) {
                $class[] = $name;
                preg_match( "https://wordpress.stackexchange.com/" . $name . '[\/|\s](\d)/i', $user_agent, $matches );
                if ( $matches[1] )
                $class[] = $name . '-' . $matches[1];
                return $class;
            }
        }
        return $class;
    }
    add_filter( 'body_class', 'os_browser_body_class' );
?>

You could simplify it as well with something like:

<?php 
$user_agent = getenv( 'HTTP_USER_AGENT' ); 
if( $user_agent == 'Windows' ) :
    $app_download = 'http://downloadurl.com/to-your-app/windows-version.zip';
elseif( $user_agent == 'Mac' ) :
    $app_download = 'http://downloadurl.com/to-your-app/mac-version.zip';
endif;  
?>

Then on your page you’d just use an echo to put the proper link in place:

echo $app_download;