Developers or advanced users may need to access iCloud Drive from the command line on Mac. Though the process is not so straightforward, it’s not difficult either. So long as you know the command line, you can quickly copy and even move files to iCloud via Terminal on your Mac.
Before going ahead with the process, you need to ensure that iCloud Drive is enabled on your Mac. If it’s not already, click on Apple Menu → System Preferences (or click on System Preferences icon) → iCloud and make sure it’s enabled. Besides, ensure that you have the proper Internet connection to access iCloud Drive and iCloud Drive files and documents using Terminal.
How to Access iCloud Drive Using Command Line on Mac
Note: The command line path to iCloud Drive in macOS is:
The “~” tilde is a shortcut for the current users home directory. However, you have the option to illustrate it based on your need.
To access iCloud Drive in the Terminal on your Mac, you need to use the “cd” command and then select the iCloud documents path’s directory.
To do so, use the following command:
cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/
Then, press the Return key to access the iCloud Drive folder.
That’s it! Now, you will have access to the iCloud Drive folder. Now, go ahead with your work.
How to Move Files to iCloud Drive by Terminal in Mac
Using command line, you can also move a file to iCloud Drive. It will upload to iCloud Drive and remove it from its original place. To do so, use the mv command.
mv ~/Desktop/images.jpeg ~/Library/Mobile\ Documents/com~apple~CloudDocs/
Now, your files will upload to the iCloud server.
How to Copy Files to iCloud Drive via Terminal on Mac
With the use of cp command, you can copy files to iCloud Drive via Terminal. The copied files are uploaded iCloud.
cp ~/Desktop/images.jpeg ~/Library/Mobile\ Documents/com~apple~CloudDocs/
That’s pretty much it!
You’d like to take a peek at these posts as well:
- How to Ping IP Address on Mac
- How to Enable Debug Menu in Safari
- How to Block Websites in Safari on Mac
- How to Start Your Mac in Recovery Mode