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
Method 1 of 3:

CD to iCloud Drive

  1. 1
    Open 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.
  2. 2
    Type 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.
    Advertisement
  3. 3
    Press Return. This executes the command and changes the directory to your iCloud Drive.[1]
    • To change back to your home directory, simply type "cd ~" and press Return.
  4. Advertisement
Method 2
Method 2 of 3:

Manage iCloud Files in Terminal

  1. 1
    List 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.
  2. 2
    Copy 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
  3. 3
    Move 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
  4. 4
    Remove 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.
  5. 5
    Create 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.[2]
    • 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.
  6. Advertisement
Method 3
Method 3 of 3:

Create an iCloud Drive Alias

  1. 1
    Open the Finder . The Finder has an icon that resembles a blue and white smiley face. Click the finder icon in the Dock at the bottom of the screen to open the Finder. If you don't want to type the full path to your iCloud drive every time you want to access your files, you can create a shortcut alias so you only have to type a few letters.
  2. 2
    Navigate to your Home folder. To do so, click your username in the menu bar to the left. This takes you to your Home folder.
  3. 3
    Press 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.
  4. 4
    Open 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.
  5. 5
    Add 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'
  6. 6
    Save the document. To save the document, click File in the menu bar at the top. Then click Save.
  7. 7
    Restart the Terminal. If you currently have a Terminal window open, go ahead and close it and then re-open it.
  8. 8
    Use 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.
  9. Advertisement

About This Article

Travis Boylls
Written by:
wikiHow Technology Writer
This article was co-authored by wikiHow staff writer, Travis Boylls. Travis Boylls is a Technology Writer and Editor for wikiHow. Travis has experience writing technology-related articles, providing software customer service, and in graphic design. He specializes in Windows, macOS, Android, iOS, and Linux platforms. He studied graphic design at Pikes Peak Community College. This article has been viewed 8,703 times.
How helpful is this?
Co-authors: 3
Updated: October 25, 2022
Views: 8,703
Categories: ICloud
Article SummaryX

1. Open the Terminal.
2. Type "cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/".
3. Press Enter.

Did this summary help you?
Advertisement