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.
6 Answers
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
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:
-
Yah, but I really want to sync a folder to both icloud and google drive and that doesn't help (sync not just backup). Commented Jan 15, 2021 at 2:15
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 :(
Yes, it's entirely possible.
You can create a directory in ~/Library/Mobile\ Documents
and then symlink that wherever you like.
-
2Maybe 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)– VenkatCommented Sep 6, 2018 at 21:28
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
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.
-
1As 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 BotCommented Jan 26 at 14:55
~/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).