PDF download Download Article PDF download Download Article

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

PDF download Download Article
  1. 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. 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. 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

PDF download Download Article
  1. 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. 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. 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. 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. 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

PDF download Download Article
  1. 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. To do so, click your username in the menu bar to the left. This takes you to your Home folder.
  3. The file you need to edit is likely hidden. Press Command + Shift + Period (.) to show hidden files on a Mac .
  4. 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. 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. To save the document, click File in the menu bar at the top. Then click Save .
  7. If you currently have a Terminal window open, go ahead and close it and then re-open it.
  8. 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

Expert Q&A

Ask a Question
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!

      About This Article

      Article Summary X

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

      Did this summary help you?
      Thanks to all authors for creating a page that has been read 32,090 times.

      Is this article up to date?

      Advertisement