PHP:wkhtmltopdf snappy(包装器)失败

i have a problem using wkhtmltopdf with snappy. I has installed wkhtmltopdf with homebrew on mac osx.

I use this code to display PDF in Browser:

<?php
    header('Content-Type: application/pdf');
    header('Content-Disposition: attachment; filename="file.pdf"');
    require_once('snappy/autoload.php');    
    use Knp\Snappy\Pdf;
    $snappy = new Pdf('/usr/local/bin/wkhtmltopdf');    
    echo $snappy->getOutput('http://www.github.com');   
?>

Instead of displaying the PDF in the browser, the script opens the terminal. After i click on the terminal it starts downloading the file.pdf. The file.pdf shows the correct github page.

What i am doing wrong? And whats the best solution to manage wkhtmltopdf's binary path that the script is working on several systems (debian, windows, ..).

EDIT:

Oh sorry.. i changed attachment to inline and the browser displays the PDF. But i must click on the terminal first..