I want to remove the symlink and instead insert the file it links to, if possible all with one command so I can have it as an "External Tool" in phpStorm.
cp --remove-destination "$(readlink <symlink>)" <symlink>
cp doesn't have the
--remove-destination parameter, you have a couple options:
brew install coreutils
And then follow the step in grg's answer (note that GNU
cpis installed as
gcp -a --remove-destination "$(readlink <symlink>)" "<symlink>"
Or remove the symlink first, e.g.
sourcefile=$(readlink "<symlink>"); rm "<symlink>" && cp -a "$sourcefile" "<symlink>"