4

Working on my MacBook Pro, I want to change the location of my iPhone backup to an external drive, but when entering the command on the CLI I hadn't noticed that the destination drive has a space in the name (HARDDRV BKUP). How would I enter the following

ln -s /Volumes/HARDDRV BKUP/iphonebkup/Backup/ ~/Library/Application\ Support/MobileSync

using "HARDDRV BKUP" as the name of the external drive in Terminal? If I recall correctly, the CLI doesn't interpret SPACES the same way, and capitalization is important to take into account as well, correct? Can someone here correct this for me?

I am new at using the CLI and most of my experience is using the GUI, so I am getting very frustrated and don't have the energy to research all my notes on this.

1 Answer 1

5

Choose one of the following:

  • Surround the part of the path containing spaces in quotes:

    ln -s /Volumes/"HARDDRV BKUP"/iphonebkup/Backup/ ~/Library/Application\ Support/MobileSync
                   ^            ^
    
  • Surround the entire path in quotes:

    ln -s "/Volumes/HARDDRV BKUP/iphonebkup/Backup/" ~/Library/Application\ Support/MobileSync
          ^                                        ^
    
  • Escape the space with a backslash \:

    ln -s /Volumes/HARDDRV\ BKUP/iphonebkup/Backup/ ~/Library/Application\ Support/MobileSync
                          ^
    

Case sensitivity is important in these cases.

2
  • I was unaware about the first one. Very elegant!
    – Nimesh Neema
    Commented Jun 4, 2019 at 21:29
  • 1
    You can also drag files and folders from the Finder into a Terminal window, and it'll insert an appropriately-escaped-for-shell version of the path. Commented Jun 5, 2019 at 7:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .