macosscriptingpermission-deniedwww-mechanize-firefox

How do you give WWW::Mechanize::Firefox permission to launch Firefox?


I'm on a Mac. I've got a simple Perl script that uses WWW::Mechanize::Firefox to pull up a web page.

The script works perfectly when Firefox is already open and running on my computer. Here's the line the creates the object:

my $mech = WWW::Mechanize::Firefox->new(
  launch => '/Applications/Firefox.app'
);

However, when Firefox is shutdown and I run the script, I get the following error:

exec failed: Permission denied at /Library/Perl/5.12/MozRepl/RemoteObject.pm line 463
 at /Library/Perl/5.12/MozRepl/RemoteObject.pm line 463

What do I do to give the perl script permission to launch Firefox?


Solution

  • Try:

    my $mech = WWW::Mechanize::Firefox->new(
      launch => '/Applications/Firefox.app/Contents/MacOS/firefox'
    );
    

    /Applications/Firefox.app is the application wrapper and is a directory that contains the various files that make up the application. The file at Contents/MacOS/firefox within the application wrapper is the main executable of the application.