"How do I perform Terminal commands on any items on my Mac that have spaces in their pathnames? Because Finder allows spaces in file and directory names, I'm often creating such with spaces but then if I try to cd to one in the Terminal the space kills the command. How is this done?"
There are three ways that I know of to handle this. They are:
- Drag-and-drop the file or directory onto the terminal; this will preserve the spaces.
- Enclose the path name in single quotes, like this:
cd '/Users/username/temp/directory with spaces'
- Quote the space character with a backslash, like this:
cd /Users/username/temp/directory\ with\ spaces