7

Is it possible to use iCloud drive like Dropbox? What I want to do is create a symbolic link to Desktop, Documents and perhaps my Downloads folder in iCloud Drive, similar to how I'd do it in Dropbox. I don't want to use the 'Desktop and Documents' setting in iCloud. It does some weird stuff with my Desktop and Documents folder locally.

Venkat
  • 209
  • 1
    What prevents you from doing so, what did you try and where did it turn out not to work as expected? – nohillside Jul 27 '18 at 15:16
  • What weird stuff does it do if you use that setting? – Natsfan Jul 27 '18 at 15:26
  • 1
    I'm hesitant to try it, because Apple has a setting for Desktop and Documents syncing. I don't know how its implemented currently, but when done previously, it moved the whole Desktop and Documents folder to ~/Library/Mobile\ Documents and then created a symlink back to the home directory. If you turn it off for whatever reason, then your Desktop and Documents folder used to disappear from home folder and reside in the Library folder. My hesitancy is honestly because I don't think Apple is super reliable with this server side stuff unlike Dropbox(in how its implemented I mean). – Venkat Jul 27 '18 at 16:03

6 Answers6

10

Just enter the below line into your terminal and you can navigate to your iCloud via the terminal.

ln -s "/Users/$USER/Library/Mobile Documents/com~apple~CloudDocs" iCloud
pretz
  • 211
3

Apple has a built-in setting to do basically exactly what you want. It's not technically a symlink, but it accomplishes the same functionality. It also gracefully handles different desktops on different machines. And it all works as expected in the Files app on iOS:

https://support.apple.com/en-us/HT206985

Alethea
  • 31
  • Yah, but I really want to sync a folder to both icloud and google drive and that doesn't help (sync not just backup). – Peter Gerdes Jan 15 '21 at 02:15
2

I faced the same issue with symlinks. It seems, unfortunately, iCloud doesn't support symlinks (except these desktop and documents folders).

But it's possible with Dropbox:

https://apple.stackexchange.com/a/319593/308689

UPD. Whoops, they dropped support of symlinks. Nobody supports symlinks :(

Jerry Green
  • 163
  • 1
  • 1
  • 9
1

Yes, it's entirely possible.

You can create a directory in ~/Library/Mobile\ Documents and then symlink that wherever you like.

Allan
  • 101,432
  • 2
    Maybe you misunderstand, but I want to create a symlink top desktop folder and documents folder and place that symlink in iCloud Drive. I have tried this, however the Files app on iOS doesn't recognize the folder, and doesn't show the contents(it thinks its an alias file that's all) – Venkat Sep 06 '18 at 21:28
1

I ended up making hard links of individual files to iCloud Drive folder.
You can make a script that would links all files from specific folder to iCloud, but it might not be practical for whole Documents.

ln myfile.txt ~/Library/Mobile\ Documents/com~apple~CloudDocs/important_folder/myfile.txt
0

Based on the man ln documentation, you need ln -sn or ln -sh:

ln -sn ~/Library/Mobile\ Documents/com\~apple\~CloudDocs MyiCloudFolder

from man:

-h If the target_file or target_dir is a symbolic link, do not follow it. This is most useful with the -f option, to replace a symlink which may point to a directory.

-n Same as -h, for compatibility with other ln implementations.

-s Create a symbolic link.

José
  • 1
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. – Community Jan 26 '24 at 14:55