In my team, there is 20% of OS X machines, rest are linuxes. We share one script, that everyone on our team uses.
That script was written by some guy on Ubuntu and guess what? GNU versions of those programs (sed and xpath) are not compatible with BSD versions. The script was failing :(
I was trying to improve the script, but forget about it. Just use GNU programs.
To install gnu sed on osx via homebrew type the following:
brew install gnu-sed --with-default-names
To install gnu xpath on osx via homebrew type the following:
brew tap concept-not-found/tap