15

The files that are displayed on the desktop come from the folder

/Users/USER/Desktop

I am wondering if there is any way to be able to change that so the files that are displayed on the desktop come from a different folder?

The aim behind this is to use Google Drive (https://www.google.com/drive/download/) and create a "Desktop" folder in my Drive account allowing me to sync and access my Desktop from anywhere without using as much storage locally with all the files at the desktop being displayed from

/Users/USER/Google Drive/Mac Desktop

2

4 Answers 4

15

Move everything you have on your Desktop to the cloud:

mv ~/Desktop/* ~/Dropbox/MyDesktopOnTheCloud/

Remove your current local Desktop folder from your home directory:

sudo rm -rf ~/Desktop

Create a symlink to your Desktop folder on the cloud:

ln -s ~/Dropbox/MyDesktopOnTheCloud ~/Desktop

On MacOS Catalina, in order to prevent the system from deleting your symlink and creating a blank Desktop folder after every system restart, change the flag of the symlink:

sudo chflags -h schg ~/Desktop

It's important to specify the -h option to instruct the chflags command not to follow the symlink. In this way, the link is unchangeable by the system, but the destination folder is not. The system can indeed save screenshots to the Desktop, for instance. If you omit the -h option, the symlink will be deleted after reboot and the folder in Dropbox will be marked as unchangeable instead.

4
14

Backup your old default Desktop folder

If you have files in your existing Desktop folder, don’t worry. We’re going to back up your existing folder so you can copy your old Desktop files to your new DropBox Desktop folder afterwards.

Simply open a terminal and enter the following command.

sudo mv desktop desktop.bak

Create a symbolic link to your new DropBox Desktop folder

The long and short is that we’re telling OSX to create a link to the Desktop folder in your DropBox, but to treat the link as if it were the default Desktop folder itself. In this way, when you save things to your Mac Desktop, they’ll appear on your Desktop as before, but actually be stored in your new DropBox folder. Here’s how to do it…

ln -s /Users/your-user-name/Dropbox/Desktop/ ./Desktop

This worked perfectly for me.

Credit goes to https://ifyouwillit.com/life/auto-sync-your-mac-desktop-folder-with-dropbox/

2
3

I found that MacOS Catalina resets the symlink on reboot. sudo chflags schg (path to link) prevents MacOS from touching the link.

1
  • 1
    It seems that doing this prevents system writes to the folder for certain functionality — for example, doing this on Desktop/ means screenshots aren't saved to the Desktop when doing CMD+SHIFT+3/4 - doing it via Finder on the symlink itself seems to work
    – zzz
    Commented Mar 30, 2020 at 16:04
2

You can try using symlinks. There is a pretty good post for dropbox usage here - try to adopt this for your needs.

These are the essential parts:

Navigate in Terminal to your Dropbox folder by typing 

cd /Users/YourMacUsernameHere/Dropbox

and then hitting return. A new line in Terminal will appear that's 

Your-Computer-Name:Dropbox YourUserName$

Create your symbolic link by typing 

ln -s ~/FolderNameHere 

and hitting return. A folder will appear in your Dropbox folder with the alias/shortcut arrow and it will immediately begin uploading.

To create a symlink to your Desktop, type 

ln -s ~/Desktop
1
  • This is almost what I wanted! However this creates only a link to the "original" folder in my "new" folder (where original refers to the folder with all the files and the new folder refers to where the files are meant to appear). How can I create a symlink where automatically all the files from the original folder get a symlink displayed in the new folder? Commented Jul 4, 2017 at 0:02

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.