How can I run the command-line on MacOS ? (As a workaround for files not being synced)

Copper Contributor


OneDrive is not syncing files that have been created on one Mac to another Mac logged in with the exact same OneDrive (personal) account, even when the option to always keep the files locally is selected on the root OneDrive folder.
Use case : OneDrive runs on both Macs. One both Macs, go to Onedrive location in the Finder. Right-click in the Finder view and select "Always keep on this device".
Then create a .docx file in the OneDrive folder on one mac. Wait. The other mac shows the file, but it is not downloaded. Attempts at accessing the file from a backup software (Arq Backup) results in an error that the file is not on disk.
This is my main problem, so if anyone has suggestions to fix it, I'll be really happy !

Now : as a workaround, I wanted to try to pin any new files from a script by running /Applications/OneDrive.App/Contents/MacOS/OneDrive /setpin as per Set Files On-Demand states on Mac on Microsoft documentation

But this does not work : launching the OneDrive app from Terminal results in an error that  is already running (well, duh, of course, otherwise how would it sync ??) : OneDrive[7456:546949] Another instance of OneDrive is already running. Shutting down.


Has anyone worked out how to actually use the app as per the documentation says ?

Thanks !

3 Replies

@Palijn This is probably not what you are looking for but it does show that scripts can work with oneDrive in a rudimentary way: 

I have used this script several times to fix sync errors caused by stricter file naming conventions. 





Thanks a lot.

I think the key here is the 

killall OneDrive || true

at start of the script

and the

[[ $(pgrep "OneDrive") ]] || open -gj "/Applications/"

 at the end of it.

The script itself does not use purported command-line functions, so I guess I'm still left to try them after having killed the app first.

@Palijn Did you manage to make it work? Exact same situation here.