wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, volunteer authors worked to edit and improve it over time.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
Do you want to access your iCloud Drive using the Terminal app on your Mac? Apple gives users plenty of convenient ways of accessing iCloud Drive using the graphical user interface. Still, more advanced users may want to copy files to and from iCloud Drive from the Linux command line. Fortunately, it's easy to use the Linux cd command to switch to your iCloud Drive directory and manage files. You can also even edit your Bash profile to create an easy-to-remember alias to cut down on typing. This wikiHow article will teach you how to cd into your iCloud Drive folder in any version of macOS.
Things You Should Know
- The path to iCloud Drive is "~/Library/Mobile\ Documents/com~apple~CloudDocs."
- You can use standard Terminal commands to move, copy, remove, files, as well as create directories in iCloud Drive.
- You can also edit the Bash profile to create an alias that will allow you to access iCloud Drive more easily in the Terminal.
Method 1 of 3:CD to iCloud Drive
1Open the Terminal. The Terminal has an icon that resembles a black screen with a white text cursor. Use the following steps to Open the Terminal:
- Click the magnifying glass icon in the upper-right corner to open the Spotlight search bar.
- Type Terminal in the search bar.
- Click Terminal.app.
2Type cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/. This is the command to change the directory to your iCloud Drive. The "cd" at the beginning stands for "change directory." Whenever you want to change directories or folders in the terminal, type "cd" followed by the path of the directory or folder you want to change to.
- The "~" symbol at the beginning of the command is a shortcut for your home directory. Type "pwd" and press Return to find out your home directory (it's usually "users/" followed by your Mac username.) You can enter your home directory in place of "~".
- To navigate to a folder within your iCloud Drive, enter the name of folder at the end of the change directory command. For example, use "cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/Downloads" to navigate to your Downloads folder in iCloud Drive.
3Press ⏎ Return. This executes the command and changes the directory to your iCloud Drive. X Research source
- To change back to your home directory, simply type "cd ~" and press Return.
Method 2 of 3:Manage iCloud Files in Terminal
1List all files and directories in your iCloud Drive. The command to list all files and folders in a directory is "ls." If you want to list all files and folders in your iCloud Drive, you would type ls ~/Library/Mobile\ Documents/com~apple~CloudDocs and press Return.
- Alternatively, you can use the "cd" command to change directories to iCloud Drive. Then just type "ls" and press Return.
2Copy files to iCloud Drive. To copy a file from your Mac to your iCloud Drive, type "cp" followed by the path to the file you want to copy. Then enter the path to the iCloud Drive immediately after and press Return.
- For example, if you wanted to copy a file from your desktop to your iCloud Drive, you would type something like cp ~/Desktop/filename.txt ~/Library/Mobile\ Documents/com~apple~CloudDocs
3Move a file to iCloud Drive. To move a file from your Mac to your iCloud Drive, type "mv" followed by the path to the file you want to move. Then enter the path to the iCloud Drive immediately after and press Return.
- For example, if you wanted to move a file from your pictures folder to your iCloud Drive, you would type something like mv ~/Pictures/filename.jpg ~/Library/Mobile\ Documents/com~apple~CloudDocs
4Remove a file. To delete a file from your iCloud Drive, type "rm" followed by the path to the file you want to delete in your iCloud Drive and press Return.
- For example, you would type rm ~/Library/Mobile\ Documents/com~apple~CloudDocs/filename.zip to delete a zip file in your iCloud Drive.
5Create a new directory. To create a new directory, use the "cd" command to change directories to the directory you want to create a new folder in. Then type "mkdir" followed by the name of the directory. X Research source
- For example, to create a directory called "Images" in your iCloud Drive, you would use the "cd" command to change directories to your iCloud Drive. Then you would type mkdir Images and press Return.
- You can also create and edit text files from within the Terminal.
Method 3 of 3:Create an iCloud Drive Alias
1Open the Finder
2Navigate to your Home folder. To do so, click your username in the menu bar to the left. This takes you to your Home folder.
3Press ⌘ Command+⇧ Shift+Period to show hidden files. The file you need to edit is likely hidden. Press Command + Shift + Period (.) to show hidden files on a Mac.
4Open the ".bash_profile" file in TextEdit. To do so, locate the ".bash_profile" file. Right-click (or hold Control and click) the file. Hover over Open With and select TextEdit.
5Add a new alias at the end of the text file. Scroll down to the bottom of the ".bash_profile" file and add the alias command. You can replace the alias "icloud" with any alias you wish. However, your alias should be simple and easy to remember. Enter the following line of text at the end of your ".bash_profile" file.
- alias icloud='cd ~/Library/Mobile\ Documents/com~apple~CloudDocs'
6Save the document. To save the document, click File in the menu bar at the top. Then click Save.
7Restart the Terminal. If you currently have a Terminal window open, go ahead and close it and then re-open it.
8Use your alias to change the directory to iCloud Drive. With the alias saved to your ".bash_profile" file, you no longer need to enter the long "cd" command to change directories to iCloud Drive, you just need to enter your alias (i.e., "icloud") and press Return to change directories. This should save you a lot of time.
- You can add more aliases to your ".bash_profile" document to simplify other Terminal commands. Just use the following format: "alias <alias name>='Terminal command.
About This Article
1. Open the Terminal.
2. Type "cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/".
3. Press Enter.