remove non-portable chmod

'chmod --reference' is not available on Mac OS X. 

Keeping the original file and directing edits into it preserves permissions and removes the need to chmod.

(Tried 'sed -i' for inplace editing but unfortunately it isn't portable either.)