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: , ,

24 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!

  14. nkraf says:

    hello,
    first of all thank you for this wonderful book!

    im running into some prob with the rank factor script, when i run the script on the terminal, btw. im using Mac OSX 10.5.8
    there is an error like this
    "Can't locate LWP/Simple.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 22.

    appreciate you could help me on this so that i could fully utilize the book and all the tools

    thank you in advance!
    BEGIN failed–compilation aborted at rankingfactors.pl line 22.

  15. matt says:

    Hi John,
    I’ve been trying to get the script running on my mac (running 10.6.6) and I have a few questions:

    • I have copied (and double-checked!) that the files ‘TreeBuilder.pm’, ‘Element.pm’ and ‘Round.pm’ are in the correct locations in my brand new XAMPP installation (version 1.7.2)

    • When I execute the script, I get the following:

    Starting..
    ..cleanup done
    ..getting SERPs
    ..got the SERPs
    ..got the real titles
    ..finished partial title comparisons
    ..finished keyword title comparisons
    ..finished title page copy comparisons
    ..finished domain name exact keyword analysis
    ..finished domain name partial keyword analysis
    File not found when calculating keyword density.
    ..finished description META analysis
    ..finished header tags analysis
    file does not exist
    ..finished keyword proximity analysis
    ..finished outbound links analysis
    ..finished outbound link PR analysis
    ..finished average page size analysis
    ..finished optimum number of words analysis
    ..finished website size analysis

    • The script hangs for a while at the keyword proximity analysis (but eventually gets past it – I noticed a few people reporting this hang in the PC instructions but patience seems to be the virtue!) – when I look at the report generated there *is* data in the keyword density and header tags columns. Should the warnings in the script be ignored or do the ‘file not found’ errors mean that the data in the report will be inaccurate?

    • Also, in which directory do I put the .profile file so I don’t have to enter the ‘export path’ line everytime? Should the .profile file contain *just* the ‘export path’ line?

    I have no experience with perl and really appreciate your help!
    Thank you
    Matt

  16. John says:

    Hi Matt,

    Thanks for your comments. Now to answer your questions:

    1) Yes, patience is the virtue (lot of processing going on). Yes DO ignore the warnings. This happens from time to time. Some reasons include timeouts in retrieving a particular page. The report should still be accurate based on all data the script was able to get.

    2) The .profile file is typically placed in your user home directory. You can find further helpful information in these 2 links:
    http://oreilly.com/pub/a/mac/2004/02/24/bash.html
    http://serverfault.com/questio.....ow-leopard

    You can have multiple commands in your .profile file.

    I hope that helps.
    John

  17. John says:

    Hello,

    Sorry for delayed reply. Please see other related posts and try following directions. From your message there is a problem in locating one of the Perl modules (Simple.pm). You need to find a way to get the script to see this file. Also see this link: http://discussions.apple.com/t.....dID=988677

    Regards,
    John

  18. Jason Hill says:

    John,

    I will add my thanks to everyone else’s. Awesome work.

    When I run the script I get the same thing as Matt above;only the file does not exist prompt happens multiple times and the last few lines read:

    ..finished average page size analysis
    ..finished optimum number of words analysis
    file does not exist (repeated 25 or so times)
    problem code:3 Bo such file or directory
    ..finished website size analysis

    When I go looking for the report it does not seem to have generated the file(s)

    Any thought? Thanks in advance for any help.

  19. John says:

    Hi Jason,

    My best advise would be to rerun the script/scenario again. Also make sure that the report folder exists. If you have another Mac or PC try runing it there as well. Please send me a screen shot of the missing file warnnings the next time you run it.

    Thanks!
    John

  20. Jason Hill says:

    John, sorry for the delay in getting back to you. I had to upgrade OS to get LWP/Simple.pm installed and it took me a little longer to find my Snow Leopard disk.

    While looking I tried again on my laptop and got the same results. Once up and running on my desktop the same things happens. Checked for the folders and they are there…and your sample reports for ‘buy shoes’ are there. I have a screenshot of warnings, where do you want me to send it?

    -Jason

  21. John says:

    Hi Jason,

    You can send it to johnj (at) this-website.net.

    John

  22. John says:

    Copying last Jason’s email (solution).

    I got it to work. Maybe I was wrong from the beginning, but I’ve
    never read anything about having to be logged in as a superuser to
    make it work. Here is what I was doing:

    Open Terminal (logged in as user/myname)
    Run the export script
    perl /applications/xampp/htdocs/book/downloads/chapter-4/rankingfactors.pl

    I would get the long list I originally sent you.

    To get it to work, I did this:
    sudo -s
    cd /applications/xampp/htdocs/book/downloads/chapter-4/
    perl rankingfactors.pl

    Was I missing something from the beginning? If not let me know and I
    am happy to summarize what I did in the blog post responses in case
    someone else needs it.

    Thanks again for all the help. I will more than likely hit you up
    again, your insights are great, the book is great, and these tools are
    phenomenal.

    and the previous email…


    Here are my permissions. The rankingfactors.pl file and the
    index.html file in the reports folder do not have the @ in the
    permissions. Could that be the cause? What kind of extended
    attributes are those files supposed to have, and is it complicated to
    change them?

    Chapter-4 Folder:
    drwxrwxrwx@ 12 root admin 408 Jan 20 15:45 .
    drwxrwxrwx@ 13 root admin 442 Jan 20 15:58 ..
    -rwxrwxrwx@ 1 root admin 10 Jan 7 2010 dos.bat
    -rwxrwxrwx@ 1 root admin 0 Jan 11 2010 find
    -rwxrwxrwx@ 1 root admin 259 Jan 8 2010 index.html
    -rwxrwxrwx@ 1 root admin 72290 Jan 12 2010 rankingfactors.html
    -rwxrwxrwx 1 root admin 63307 Jan 12 2010 rankingfactors.pl
    -rwxrwxrwx@ 1 root admin 73616 Jan 11 2010 rankingfactors.pl.original.txt
    drwxrwxrwx@ 6 root admin 204 Jan 12 2010 report
    drwxrwxrwx@ 21 root admin 714 Jan 12 2010 serptemp
    -rwxrwxrwx@ 1 root admin 52 Jan 11 2010 setpath.bat
    -rwxrwxrwx@ 1 root admin 1360 Jan 8 2010 view.php

    Report folder:
    drwxrwxrwx@ 6 root admin 204 Jan 12 2010 .
    drwxrwxrwx@ 12 root admin 408 Jan 20 15:45 ..
    -rwxrwxrwx@ 1 root admin 10133 Jan 12 2010 bing.html
    -rwxrwxrwx@ 1 root admin 9408 Jan 12 2010 google.html
    -rwxrwxrwx 1 root admin 258 Jan 12 2010 index.html
    drwxrwxrwx@ 24 root admin 816 Jan 12 2010 maps

  23. neilgee says:

    Hi John,
    I am getting the same error as “nkraf” above.
    When running the script originally I get the “Can’t locate LWP/Simple.pm ”

    So I copied the LWP directory and filed it in both /perl5/site_perl/5.10.1 and /perl5/5.10.1 but now when i run the script I get:

    “BEGIN failed–compilation aborted at /Applications/XAMPP/xamppfiles/lib/perl5/5.10.1/LWP/Simple.pm line 14.
    Compilation failed in require at rankingfactors.pl line 22.
    BEGIN failed–compilation aborted at rankingfactors.pl line 22.”

    I am running OSX 10.7.2.

    Any thoughts?

  24. John says:

    Hi Neil,
    May want to check these links:
    https://bbs.archlinux.org/viewtopic.php?pid=715402
    http://stackoverflow.com/quest.....-pm-in-inc
    http://www.perlmonks.org/?node_id=280985
    http://ubuntuforums.org/archiv.....79901.html

    Also just by looking at your errors, it seems as if either LWP is not visible to Perl or you will need to install LWP or even some other modules.

    I hope that helps.
    John

Leave a Reply

You must be logged in to post a comment.