macOS: How to Access iCloud Drive in Terminal

OSXDaily has a great tip on how to access iCloud Drive in Terminal. If you prefer the Terminal over the GUI, or just want a different way to create and move files and folders, this is the tip for you.

[macOS: Use Clipboard in Terminal Without a Mouse]

iCloud Drive in Terminal

First, we’ll need to know the file path of iCloud Drive:

~/Library/Mobile\ Documents/com~apple~CloudDocs/

Now, to navigate to iCloud Drive, we’ll be using the CD command, like so:

Changing directories to access iCloud Drive in Terminal.
Changing directories
cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/

You can use the command “ls” to get a list of the folders in each directory.

Copy Files

Now in order to copy files to iCloud Drive, you can use the “cp” command:

cp ~/Desktop/filename.zip ~/Library/Mobile\ Documents/com~apple~CloudDocs/

If you’ve already navigated to iCloud Drive, you’ll have to change directories to copy files. That’s what the CD command is. So before you copy a file to iCloud Drive, move back to your user directory:

cd /Users/USERNAME

Then you can copy a file with the previous command. It’s a bit confusing if you’re not used to Terminal.

Page 2: Copying and Moving Files and Folders

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.