Copy files and share folders
Move files between your Mac and a machine by copying them, sharing a folder, or sharing the clipboard.
Copy files
In a Windows or macOS machine, drag files between Finder and the machine window. This works while you're signed in at the machine and its screen is unlocked.
To copy in Terminal, put the machine's name before the guest's full path:
osmates vm copy notes.txt dev:/tmp/
osmates vm copy dev:/var/log .
osmates vm copy notes.txt 'win:C:\Users\Public\'
vm copy goes through the guest agent and checks each file's SHA-256 checksum. Files copied into Linux or macOS belong to root, unless you pick an account as the vm copy reference shows.
Share a folder of your Mac
- Choose Machine > Machine Settings, then click Sharing.
- Click + and choose a folder.
- To keep the machine from changing it, turn on Read Only.
| System | Where the share appears |
|---|---|
| Windows | The drive labeled osmates, usually Z: |
| Linux | /mnt/osmates/<name> |
| macOS | /Volumes/osmates/<name> |
To share in Terminal:
osmates vm set dev --share code=$HOME/Projects/code --read-only
A clone keeps its source's shares. Clones that an agent or osmates run makes get none. If a Linux or macOS machine shows stale content, run osmates vm remount-shares dev.
See what a machine changed in a shared folder
Programs in a machine can change shared files your Mac runs later, such as Git hooks and build files. When the machine stops or an agent's session ends, a notification lists any that changed. Click Show in Finder and read them before Git or your editor runs them.
osmates audit show dev lists them too. Very large folders are checked only in part, and osmates vm events dev says when. A read-only share needs no check, so share a repository Read Only, or work on a copy.
Share the clipboard
- In the machine window, choose I/O > Clipboard.
- Choose Off, Mac to Machine, Machine to Mac, or Both Ways.
| System | What's shared |
|---|---|
| Windows, macOS | Text, images, and files |
| Linux | Plain text, with xclip (X11) or wl-clipboard (Wayland) in the guest |
To copy from the machine, keep its window in front when its clipboard changes. In a macOS machine, allow OSMates Agent to paste from other apps, or the guest's copies don't reach your Mac. Machines that agents make start with sharing off.
Open files copied from a guest
Files you copy or drag out of a machine carry quarantine information, as downloads do. macOS checks an app or script before it first opens. Files in a shared folder aren't quarantined. A volume that can't store quarantine information refuses the copy.
To remove the quarantine from files you trust:
chmod -R u+rwX ~/Downloads/build
xattr -dr com.apple.quarantine ~/Downloads/build
Work on a copy of a repository
To change a repository in a machine without touching your folder, push a copy in and bring a patch back:
osmates workspace push dev ~/Projects/app
osmates workspace diff dev
Read the report beside the patch before you git apply it. It flags changes that could run code on your Mac. See Code with an agent in its own machine.