How to run a command inside a script without specifying the exact location?

Half an answer...

Make sure that wget is in your default PATH environment variable for the user you run the script with (on each machine). Looking at the output of exec('echo $PATH') might be a good way to do this. The result has to be like ...:/usr/local/bin:....

Dunno how to change the default PATH value on OSX though.