Os-x support for download-file and remote-directory

- readlink -f doesn't work on mac. Use lib/canonical-path instead of calling readlink directly.
- quoted strings don't work on mac curl. So added new download-file implementation for os-x