If you’re having issues with high CPU usage with your OneDrive for macOS installation you might want to try the following fix suggestions.
Microsoft has made Files On-Demand available for High Sierra or later back in January 2019.
I have been using this in order to keep the Files On-Demand feature that has been available for some time now in a specific preview build. I can’t say though, if there has been any kind of update to this build Microsoft is making available (download here).
The Files On-Demand feature works well enough on this build and it’s so useful that I’ve been using despite the issues it has.
The main issue I’ve been struggling with is that OneDrive will stop working after some days – it will just crash without any warning soon after the app loads. As this is a silent crash, you won’t even be aware that your files are not being synced at all uploading files correctly, at least some files appear to get stuck in the upload queue.
Check File Permissions and Attributes
One issue that may be causing files getting stuck in Onedrive for Mac’s upload queue is wrong permissions. While Apple has a specific permission reset instructions article available, my experience it didn’t help. I found that the files getting stuck had 644 permissions in contrast to the rest, which had 755.
ls -l
-rw-r--r--@ 1 me staff 107260 7 Apr 2018 File 1.xlsx
-rw-r--r--@ 1 me staff 343518 26 Feb 11:51 File 2.xlsx
-rwxr-xr-x@ 1 me staff 342727 15 Feb 14:52 File 3.xlsx
-rwxr-xr-x@ 1 me staff 81301 5 Feb 13:20 File 4.xlsx
-rwxr-xr-x@ 1 me staff 234993 26 Feb 12:58 File 5.xlsx
In the example above the two top files were stuck in the upload queue.
So using Terminal I reset these permissions for all files back to 755 by issuing the command below within the OneDrive folder:
sudo chmod -R u=rwx,g=rx,o=rx
.
If your OneDrive folder is in the default user home location you can get there by issuing cd ~/OneDrive
after which you can issue the command above.
The files didn’t upload straight away after these commands, but a few minutes later all were uploaded. After that I exited OneDrive, and started it again, after which I had no more excessive CPU usage.
Another Fix
The following instructions are only for the Standalone version of OneDrive (i.e. if you didn’t get OneDrive for Mac via the Mac Store; if this is your case, just try removing the app and clearing the KeyChain manually).
Considering that OneDrive is not loading or if it is constantly crashing, you might want to follow the steps below. This will reset all KeyChain entries (including the login), and some other settings, so you’ll basically have to login again and wait for OneDrive to check all your local files against the online stored versions.
Here we go:
- Close OneDrive using the app (if open), by pressing the cloud icon and selecting Settings > Quit.
- Open Activity Monitor and kill any OneDrive related task you find (there might be some OneDrive Finder Integration entries there as well).
- Open Finder, navigate to Applications > OneDrive.app, right-click it and select Show Package Contents.
- Navigate to Contents > Resources
- Find “ResetOneDriveApp.command” or “ResetOneDriveAppStandalone.command” and double-click it.
- After that a Console script should run on its own and you can close it when completed.
- Open OneDrive again and login.
Caveats for the Fix above
Note that if you are using Files On-Demand and experiencing similar issues to mine, the procedure above will probably also reset your default selection for files and folders you have manually excluded from your synchronization selection (i.e. “Free up space”).
Essentially, you’ll have to choose whichever ones you want or leave it to OneDrive to manage it.
For More on OneDrive for Mac troubleshooting
Microsoft FAQ:
https://support.office.com/en-us/article/onedrive-for-mac-faq-3fc4062c-8051-4392-bff1-551e32840cd0