I tried cd "~/Library/Application Support/" -bash: cd: ~/Library/Application Support/: No such file or directory

also cd ~/Library/Application Support/ -bash: cd: ~/Library/Application Support/: No such file or directory


You can use the Tab key after pressing the first few characters (this will then "fill in" the rest of the folder for you e.g. type cd ~/LTab fills in cd ~/Library/ then type ApTab and it will fill in the rest for you.

If there is a space between words and you don't want to use the methods above, put a \ (backslash) before the space, e.g. cd ~/Library/Application\ Support.

  • Is the path case sensitive or insensitive? I can access Library by cd ~/library, but the tab method won't work if i got case wrong. – colinfang May 24 '11 at 3:30
  • @colinfang OS X is case insensitive, but case-preserving. The bash shell must be a bit more discriminating when it comes to autocomplete. – NReilingh May 24 '11 at 3:38
  • @NReilingh - Aha, thx. – colinfang May 24 '11 at 3:42
  • 1
    @colinfang: You can use shopt -s nocaseglob and bind 'set completion-ignore-case on' to make bash less sensitive to case. – Chris Johnsen May 24 '11 at 4:27
  • 2
    colinfang - For a case insensitive tab completion with bash compatibility try 'zsh'. Also the wildcard completion of this shell is very good. – Ɱark Ƭ May 24 '11 at 14:07

The core issue here is how the shell (bash) does quoting and how that affects tilde expansion and splitting into “words” (arguments for the program being run).

bash only treats the leading tilde specially if it is not quoted. In addition, the following slash must also not be quoted.

At the same time, bash parses command lines into “words” based on non-quoted whitespace. The cd command typically requires exactly one argument (the destination directory). A command line like cd foo bar means to run cd with two arguments: foo and bar. If you only wanted to send a single foo bar argument, then you need to quote the space:
(e.g.) cd foo\ bar (see more quoting example below).

In your particular situation, you need to leave the tilde and the following slash unquoted while quoting the space in the directory name. Your cd "~/Library/Application Support/" trial ends up quoting too much (the tilde and its slash), while your cd ~/Library/Application Support/ trial quotes too little (it omits quoting the space in the directory name).

The most common solution is to use single-character escaping to quote just the space:

    cd ~/Library/Application\ Support

You can also use single or double quotes around either just the space or the space and some other bits of that argument (but not the ~/!):

    cd ~/Library/Application' 'Support
    cd ~/Library/Application" "Support
    cd ~/Library/App'lication 'Support
    cd ~/Library/Application" Supp"ort
    cd ~/'Library/Application 'Support
    cd ~/"Library/Application "Support

These kinds of quotes have different meanings, but they are identical in these examples. Single quotes protect literal strings while double quotes allow various expansions and substitutions in the quoted region.

Often, you can just let the shell do the work for you.

  • Globbing (wildcards):

    cd ~/L*/Ap*

    You can use shopt -s nocaseglob to make globbing case insensitive:

    cd ~/l*/ap*
  • Completion:

    Pressing Tab after entering cd ~/L will probably expand it to cd ~/Library/.
    Pressing Tab again after entering Ap (you now have cd ~/Library/Ap) will probably expand it to cd ~/Library/Application\ Support/ (the shell automatically inserted the escaping backslash).

    You can use bind 'set completion-ignore-case on' to make completion case insensitive:

    cd ~/l Tabcd ~/Library/; ap Tabcd ~/Library/Application\ Support/


When you double-quote a path, you're stopping the tilde expansion. So there are a few ways to do this:

cd ~/"My Code"
cd ~/'My Code'

The tilde is not quoted here, so tilde expansion will still be run.

cd "$HOME/My Code"

You can expand environment variables inside double-quoted strings; this is basically what the tilde expansion is doing

cd ~/My\ Code

You can also escape special characters (such as space) with a backslash.


You can alternatively just drag a folder to the Terminal window too, the complete file/folder path will be auto-pasted on drag.


You need to escape the space in "Application Support"

Try $ cd ~/Library/Application\ Support/


If the normal ways don't work, trying substituting spaces with %20.

This worked for me when dealing with SSH and other domain-style commands like auto_smb.


You can try this for spaced folders/files by If the file or folder name contains 1)file name.extension the command should be cd ~/file\ name.extension/ (or) cd ~/"file name.extension"/

  • 1
    How does this answer differ or improve upon any of the other, similar, answers? – fsb May 23 '17 at 13:07
  • Its the perfect terminal syntax for defining space and giving quotes is one of the user defined one and also using tab key does not take the name like 1)filename.ext 2)file name.ext While pressing tab for this type of name the auto completion of words are display upto "file" at that time we can use this backslash to define the space in terminal. @fsp – prasanth sivanesan Jun 28 '17 at 11:04
  • All of that info should be in the Answer to show readers how it's different from the 9 other Answers, including the accepted Answer. – fsb Jun 28 '17 at 12:35

You must log in to answer this question.

protected by nohillside Jan 29 '18 at 5:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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