Apple
How to Access iCloud Drive from Command Line in Mac OS
Some Mac users may require access to their iCloud Drive using the Terminal application on Mac OS. In contrast, if you’ve attempted to access iCloud Drive using the command line on your own, you may have observed that it does not show in the user’s Home directory. This is due to the fact that iCloud Drive is really located somewhere else in Mac OS, and as a result, in order to access iCloud Drive from the command line, you will need to go around in the user Library folder rather than the Home folder.
Using the Terminal, we’ll demonstrate how to access iCloud Drive folders and files from the command line in Mac OS X, as well as how to swiftly and simply navigate to iCloud folders and files.
This should go without saying, but you’ll need iCloud Drive activated on your Mac, as well as an active internet connection in order to complete this task. You would not be able to access iCloud Drive from the command line, let alone through the Finder, if you did not meet those requirements.
Read Also: How To Add A Widget In MacOS Monterey
The iCloud Drive Path for Terminal in Mac OS
The following is the command line route to access iCloud Drive in Mac OS:
The “tilde” symbol represents a shortcut to the current user’s home directory, but you may alternatively select to annunciate the whole path for a specific user folder if desired, as seen below:
How to Access iCloud Drive from the Command Line in Mac OS
For Mac OS users, the familiar “cd” command may be used to get to the iCloud Drive directory specified in the path to their iCloud documents above. In this case, the whole command to access iCloud Drive using a terminal would look like this:
After pressing the Return key, you’ll be sent to the iCloud Drive folder. It is possible to verify this by running ‘ls’ and printing a list of the contents of the iCloud Drive folder, or by typing ‘pwd’ and printing the current working directory.
Even though most people will access iCloud Drive through the Finder by clicking on it in the sidebar or selecting it from the Go menu, many sophisticated users will welcome having direct command line access to iCloud Drive as an additional feature.
If it’s any consolation, it was only a couple of Mac OS versions ago that iCloud documents and what eventually became iCloud Drive were hidden from even the Finder, and you had to access iCloud documents in the Finder via the same directory path in Mavericks that we just detailed above, whereas now with modern Mac OS releases, there is a simple always accessible “iCloud Drive” item in the Finder sidebar of MacOS.
Moving Files to iCloud Drive by Terminal in Mac OS
When using Mac OS, you may easily move a file to iCloud Drive by using the command line interface. It is important to note that when you move a file to iCloud Drive, it will upload to iCloud Drive but will be deleted from the location where it was previously stored on the local file system. This is accomplished by using the straightforward mv command. To illustrate, let’s use the same example as before and move a file named test.zip from your desktop to your iCloud Drive account.
Once again, this file must be uploaded to the iCloud server, therefore it may take some time for the transfer to be completed.
Video