Some of your have asked me to create a tutorial for Mac for running rankingfactors.pl script. This post is the answer to your queries. Without further ado here are the steps:

PART 1 – Installing XAMPP & Copying Files

1> Download XAMPP for Mac at  this link

2> Install XAMPP using instructions at: this link (just a couple of steps)

3> At this point you can go to the htdocs folder on your Mac (/Applications/XAMPP/htdocs)

4> You can cleanup this folder by placing all files and folders into a single folder or leave it as is.

5> Assuming you have downloaded the windows version of SEO Warrior (xampp distribution) simply copy all files and folders from the ‘htdocs’ (windows) to your Mac ‘htdocs’ folder.

6> Copy TreeBuilder.pm, Element.pm from the Windows (zip:\xampp\perl\site\lib\HTML) distribution to /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0/HTML/

7> Copy Round.pm from the Windows (zip:\xampp\perl\lib\Math\MATH) distribution to /Applications/XAMPP/xamppfiles/lib/perl5/5.10.0/Math

With this step you will avoid getting the following error message:
Can't locate HTML/TreeBuilder.pm in @INC (@INC contains: /Applications/XAMPP/xamppfiles/lib/perl5/5.10.0/darwin-2level /Applications/XAMPP/xamppfiles/lib/perl5/5.10.0 /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0/darwin-2level /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0 .) at rankingfactors.pl line 25.

8> Next we need to setup the path. You can execute the following command in a Terminal window (just for this window session) or place it in your .profile file (as a more permanent solution). Note: this is a single line and the only white space is after the ‘export’ word.

export PATH=/Applications/XAMPP/xamppfiles/lib/perl5/5.10.0:/Applications/XAMPP/xamppfiles/lib/perl5/site_perl/:/Applications/XAMPP/xamppfiles/bin/:$PATH

You are now ready to run the script. Simply go to the /Applications/XAMPP/book/downloads/chapter-4 folder. (i.e. perl rankingfactors.pl 10 buy shoes)

That’s it! These instructions could also be helpful for Linux installations as well (especially the modules part).

Regards,
John

Post to Twitter

Tags: , ,

13 Responses to “Step-by-step Mac Tutorial for rankingfactors.pl”

  1. dreamlife says:

    I already have xampp 1.7.2 installed, what do I do?

  2. John says:

    Please follow the tutorial from step (3). If you have installed everything using defaults it should be easy. Otherwise, make sure that your directory structure is the same or adjust the paths according to your current XAMPP directory setup.

    Regards,
    John

  3. mark says:

    Hi John, I am on a Snow Leopard Mac, and followed your instructions. Installed xampp fine, copied the files as described, created a .profile file and pasted in the path, but still get the @INC error, and now xampp seems not to be working either:

    Warning: file_put_contents(../../install/xampp_language.txt) [function.file-put-contents]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/xampp/lang.php on line 2

    Warning: Cannot modify header information – headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/xampp/lang.php:2) in /Applications/XAMPP/xamppfiles/htdocs/xampp/lang.php on line 10

    I also get errors when trying to run getRanking.pl (and have to run it from the same directory in terminal).

    sh: wget: command not found
    sh: line 1: –output-document=gserp.html: command not found
    sh: wget: command not found
    sh: line 1: –output-document=bserp.html: command not found
    number of tokens:-1number of tokens:-1

    Any thoughts or help? Would very much like to run the scripts!!!

  4. John says:

    Hi Mark,

    I would suggest following all the steps first (manual approach without the .profile part). I would also reinstall your xampp since it looks like it is no longer working.

    For the getRanking.pl script, you would need to download wget command for Mac. As long as wget is in your path it should be okay. Here are some links that should help:

    - http://www.mactricksandtips.co.....minal.html
    - http://wget.darwinports.com/

    I hope that helps!

    Regards,
    John

  5. glenshewchuck says:

    Hi, I’m on snow leopard and already have XAMPP installed and working and really don’t want to reinstall it.

    So as per instructions. #7 copied Round.pm to correct directory. #6 the HTML directory did not exist so I created and copied TreeBuilder.pm, Element.pm to their. The script does not find them. I find it interesting that I had to create the directory. What is wrong? Any help would be great! The only difference is the directory on mine is 5.10.1 not 5.10.0.

    Thankx,
    Glen

  6. John says:

    Hi Glen,

    Thanks for your note. As for the script not finding the Perl module files I would suggest checking the path. Furthermore, In my HTML directory I have the following files:

    > Element.pm
    > Entities.pm
    > Filter.pm
    > Form.pm
    > HeadParser.pm
    > LinkExtor.pm
    > Parser.pm
    > Perlinfo [directory]
    > PullParser.pm
    > Tagset.pm
    > TokeParser.pm
    > TreeBuilder.pm

    You may want to check that you have these files too. You may want to compare files in the xampp.zip to your XAMPP installation (providing that you can do some shell commands to do the comparison). Be careful in copying module files to your current XAMPP install (make sure you have a backup). If you have some knowledge in Perl you could debug the script (example: try commenting each ‘use’ line, one-at-a-time at the top while analyzing any errors…you may get clues if you are missing any other Perl modules).

    I hope that helps.

    John

  7. spizz says:

    OK. Help!
    Followed instructions to #5 and get the following error when I load XAMPP (which worked perfectly at step #2).
    Warning: file_put_contents(../../install/xampp_language.txt) [function.file-put-contents]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/xampp/lang.php on line 2

    Warning: Cannot modify header information – headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/xampp/lang.php:2) in /Applications/XAMPP/xamppfiles/htdocs/xampp/lang.php on line 10

  8. spizz says:

    I resolved the previous problem by consolidating all files in /Applications/XAMPP/htdocs into one folder, then copying the files over.

  9. spizz says:

    Now I get the following error:
    -bash: /Applications/XAMPP/xamppfiles/htdocs/book/downloads/chapter-4/rankingfactors.pl: /usr/local/bin/perl^M: bad interpreter: No such file or directory

  10. spizz says:

    Nevermind. I am a total newb. Did not know that you had to run script by typing perl rankingfactors.pl. Maybe that should be included in instructions for us newb dweebs.

  11. spizz says:

    What does the 10 after the rankingfactor.pl define or do?

  12. John says:

    Thanks for your comments. The number 10 stands for the number of results to process. The script works with the top 10 at the moment. I think you can also try 100.

    John

  13. John says:

    No problem. That was my mistake I have added the “perl” part. Thanks!

Leave a Reply

You must be logged in to post a comment.