How to Access iCloud Drive Using Terminal on Mac

macos
#1

If you are searching for the way of using Terminal to access iCloud on your Mac, this post is absolutely for you. Terminal has been a very supportive assistant in macOS, which allows users to manage their files sufficiently and quickly. In addition, it is possible for those who are owning a Mac to access iCloud Drive from a command line in Terminal. Follow these simple steps to do so.

How to Access iCloud Drive Using Command Line on Mac

Notice:

The command line path to iCloud Drive in macOS is:

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

In this command line, the “~” tilde corresponds to the current users home directory.

In order to access iCloud Drive in the Terminal on your Mac, you can add “cd” before the directory of the iCloud path:

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

Afterward, press the Return key to access iCloud Drive folder.

Now, you are in the iCloud Drive directory. Keep reading to find out more useful tips

How to Move Files to iCloud Drive by Terminal in Mac

Indeed, you are able to transfer your files to iCloud Drive by taking advantage of Terminal. Using the command line below can help you upload your file to iCloud and delete it in the initial location. In this case, I would like to move the file “images.jpeg”.

mv ~/Desktop/images.jpeg ~/Library/Mobile\ Documents/com~apple~CloudDocs/

That’s it, you have just successfully uploaded your file to iCloud.

How to Copy Files to iCloud Drive via Terminal on Mac

At times, you may desire to upload the file to iCloud but also keep it in the original directory. In this case, you can use “cp” instead of “mv” to do so.

cp ~/Desktop/images.jpeg ~/Library/Mobile\ Documents/com~apple~CloudDocs/