How to sync your Mac desktop via iCloud

MackBook Air desktop is synced via iCloud
MacBook Air desktop is synced via iCloud

I'm pretty sure you once had been in such a hurry in the end of a working day when someone gave you a file from USB stick or e-mailed it. You just did nothing but put it on your desktop. Okay, but how to take it back from the office computer?

You can sync your desktop contents through iCloud Documents!
Bonus: since iCloud free space is just 5Gb, you are not going to litter your desktop with huge files :)

How to set it up?

Launch Terminal, starting our work.
1.
Let's navigate to our home folder:
cd ~/

2.
Create a folder in iCloud that will contain desktop files:
mkdir "Library/Mobile Documents/com~apple~CloudDocs/Desktop"

3.
Copy there the whole your desktop, keeping all attributes:
cp -p -R -v Desktop/* "~/Library/Mobile Documents/com~apple~CloudDocs/Desktop/"

4.
Rename your original "Desktop" folder in user profile:
sudo mv Desktop Desktop_
You could delete it immediately, but it's a good idea to keep a backup for a case.

5.
Create a symbolic link to the new desktop location:
sudo ln -s "Library/Mobile Documents/com~apple~CloudDocs/Desktop" Desktop

6.
Relaunch Finder:
killall Finder

Icon order will reset, so it's a good chance to review what is indeed necessary to keep :)

Done!

From now on, when you delete files from desktop, the warning message will be different:

File deletion warning from iCloud
File deletion warning from iCloud

When saving a file or a folder to desktop, you will see its iCloud sync status:
Desktop file is being synced to iCloud
Desktop file is being synced to iCloud

As a bonus, with release of iOS 9 and OS X El Capitan you will be able to access your desktop docs from mobile device or in browser.
For now, it's possible to check how much storage is used and delete any file, if necessary, from iCloud settings on a phone or tablet:

List of desktop files in iCloud settings
List of desktop files in iCloud settings

7.
If it is going smoothly and syncs as it should, you can now delete an old desktop backup:
rm -fr ~/Desktop_

You can now repeat all steps starting with 3 and use the same desktop on any of your computers logged in to the same iCloud account!

Author is not responsible for any of your possible errors or damage caused by unsufficient experience in Terminal.

1 thought on “How to sync your Mac desktop via iCloud”

  1. I found that after switching to desktop syncing as I suggested in this post, Save for Web and Devices in Photoshop was unable to save files after doing adjustments. In fact, before displaying the file save dialog, Photoshop returned an error message. This was because last save location was ~/Desktop, the folder no longer existed (a symlink instead).
    To overcome this, I had to temporarily put back a desktop folder, open the Save for Web and Devices, choose any other folder to save file, and then restore the symlink:

    1.
    rm ~/Desktop

    2.
    mkdir ~/Desktop

    3.
    Open Save for Web and Devices in Photoshop.

    4.
    Save file to whatever folder outside Desktop.

    5.
    rmdir ~/Desktop

    6.
    ln -s ~/Library/Mobile\ Documents/com~apple~CloudDocs/Desktop ~/Desktop

Leave a Reply