To change directory in Mac Terminal, type cd, a space and a folder path, then press Return, for example cd Documents or cd ~/Desktop. cd .. goes up one level, cd alone goes home, and pwd shows where you are.
Table of Contents
Step 1: Open Terminal and see where you are
Open Spotlight, type Terminal and click it, or open /Applications/Utilities in Finder and double-click Terminal, as Apple’s Terminal guide describes. A new window usually opens in your home folder; Terminal > Settings > General can change that. The zsh prompt shows your user name, your Mac’s name and the current folder, like you@your-mac ~ %, where ~ means home. The examples write the prompt as $; type only what follows it.
pwd prints the full path of the folder you are in, and ls lists what it contains. ls -a also shows hidden items, and ls command options explained covers more flags.
$ pwd
/Users/you
$ ls
Desktop Downloads Movies Pictures
Documents Library Music Public
Step 2: Change into a folder with cd
cd is short for change directory, and a directory is what Finder calls a folder. Type cd, a space and the folder’s name, then press Return. A path with no / or ~ at the start, like Documents or Projects/website, is relative: it begins at the folder you are in. Terminal prints nothing when cd works, so run pwd to confirm.
$ cd Documents
$ pwd
/Users/you/Documents
$ ls
notes.txt Projects Tax Returns
$ cd Projects/website
$ pwd
/Users/you/Documents/Projects/website
Step 3: Use an absolute path or ~ from any folder
A path that starts with / is absolute, so it works from any folder. A path that starts with ~ begins at your home folder, so cd ~/Desktop and cd ~/Downloads work from anywhere too. Apple’s guide to paths lists ~ with the other path shortcuts, . and ...
$ cd /Applications
$ pwd
/Applications
$ cd ~/Downloads
$ pwd
/Users/you/Downloads
Step 4: Go up a folder with cd ..
.. means the parent folder: cd .. goes up one level and cd ../.. goes up two. Put a name after it to enter a sibling folder, as in cd ../blog.
$ cd ~/Documents/Projects/website
$ cd ../blog
$ pwd
/Users/you/Documents/Projects/blog
$ cd ..
$ pwd
/Users/you/Documents/Projects
$ cd ../..
$ pwd
/Users/you
Step 5: Go home with cd, and back with cd –
cd on its own goes to your home folder, and so does cd ~. cd - jumps back to the folder you were in before and prints its path.
$ cd /Applications
$ cd
$ pwd
/Users/you
$ cd -
/Applications
Step 6: Change into a folder with spaces in its name
A space ends a word, so zsh reads cd Tax Returns as two words and replies cd: string not in pwd: Tax. Put the name in quotes, or put a backslash before each space; Apple’s guide to paths shows both forms.
$ cd ~/Documents
$ cd Tax Returns
cd: string not in pwd: Tax
$ cd "Tax Returns"
$ pwd
/Users/you/Documents/Tax Returns
$ cd ..
$ cd Tax\ Returns
$ pwd
/Users/you/Documents/Tax Returns
Step 7: Let Tab finish folder names for you
In the default zsh setup, type the first letters of a name and press Tab, and zsh fills in the rest. It adds a / after a folder and a backslash before each space:
cd Docand Tab givescd Documents/.cd Documents/Taxand Tab givescd Documents/Tax\ Returns/.cd Dand Tab listsDesktop/,Documents/andDownloads/, because several names match. Type another letter and press Tab again.
Step 8: Drag a folder from Finder into Terminal
Type cd and a space, drag the folder from a Finder window onto the Terminal window, then press Return. Apple’s guide to dragging items says the item’s absolute path appears on the command line; you can also drag a folder from the title bar of a Finder window.
To open Terminal already inside a folder, choose View > Show Path Bar in Finder, Control-click the folder in the path bar and choose Open in Terminal; Services > New Terminal Tab at Folder opens a tab, as Apple documents.
Step 9: Change to an external drive under /Volumes
Each mounted drive is a folder inside /Volumes, named after the drive, and ls /Volumes lists them. Apple’s guide to managing files uses /Volumes/Data the same way. A drive named USB Drive needs quotes:
$ cd "/Volumes/USB Drive"
$ pwd
/Volumes/USB Drive
$ ls
Backups Photos readme.txt
Step 10: Open the current folder in Finder with open .
open . opens the current folder in a Finder window, as if you had double-clicked it. Once you are in the right folder, the terminal commands cheat sheet shows cp, mv, rm and mkdir with examples.
$ cd ~/Documents
$ open .
Where you really are: pwd vs pwd -P
A symlink (symbolic link) is a name that points to another file or folder. After you cd into one, pwd prints the path through the link and pwd -P prints where it really leads:
$ mkdir real_target
$ ln -s real_target link_to_target
$ cd link_to_target
$ pwd
/path/to/link_to_target # logical: the path you actually typed to get here
$ pwd -P
/path/to/real_target # physical: symlinks resolved
cd tracks how you got somewhere, not just where you ended up. Plain pwd (and the $PWD variable) report the logical path through the symlink you used; pwd -P resolves every symlink and reports the real location on disk. A script that captures $(pwd) and later compares it against a path built with realpath or readlink -f gets two different strings for the same folder.
macOS has symlinks of its own: after cd /tmp, pwd prints /tmp and pwd -P prints /private/tmp. ln -s made the link above, and creating and managing symlinks explains when relative and absolute links break.
How cd - and the ~ shortcut work
Continuing from the symlink example, cd /tmp then cd - returns to the folder you left:
$ cd /tmp
$ cd -
/path/to/link_to_target # back to wherever you were before /tmp
$ cd # no argument
$ pwd
/Users/you # home directory, every time
$ echo ~
/Users/you # ~ expands to $HOME before the shell even runs cd
cd - swaps with exactly one previous directory. It is a toggle, not a stack: running it twice in a row bounces you between the same two places. ~ is shell expansion, not a cd feature, so echo ~, ls ~/Documents and cd ~ all resolve it the same way before the command runs.
Fix cd: no such file or directory
zsh prints cd: no such file or directory: Documnts when a path doesn’t exist from where you are; bash 3.2.57 prints bash: cd: Documnts: No such file or directory. Check these causes:
- A typo.
lsshows the exact spelling, and Tab (step 7) fills names in for you. - The wrong starting folder. A relative path begins where you are, so
cd Projectsfails unless you are in Documents. Runpwd, or give the whole path. - A space or a quoted ~. bash 3.2.57 tries only the first word of
cd Tax Returns:bash: cd: Tax: No such file or directory. Quotes also stop~expanding, socd "~/Documents"printscd: no such file or directory: ~/Documents. - Capital letters. The default APFS format ignores case, so
cd documentsopens Documents; on an APFS (Case-sensitive) volume it fails withcd: no such file or directory: documents. Rename a File in Terminal covers case-only renames.
Fix cd: permission denied on a folder you can read
A folder needs the execute (search) permission before cd can enter it, even if you can read its listing. This bash transcript makes one without it:
$ mkdir noexec_dir && touch noexec_dir/secret.txt
$ chmod 600 noexec_dir # read+write, no execute/search bit
$ ls -ld noexec_dir
drw------- ... noexec_dir
$ cd noexec_dir
bash: cd: noexec_dir: Permission denied
$ ls noexec_dir
ls: fts_read: Permission denied
secret.txt
Read (r) was still on, so ls could see the file name, but without execute (x) it couldn’t fully open the folder to check the entry’s own permissions, and cd refused outright. In a Terminal window ls prints secret.txt first; redirected to a file, the error comes first. zsh words the same error as cd: permission denied: noexec_dir. For a folder you own, chmod u+x noexec_dir (or chmod 700 noexec_dir) restores the bit and fixes both commands.
If the folder belongs to another user, or the message says “Operation not permitted”, the cause differs: fixing permission denied in Terminal matches each message to its fix.
I ran every command above on macOS 26.6 with zsh 5.9, the default shell for new accounts, and ran /bin/bash 3.2.57 for the bash wording. I used a mounted disk image in place of a real external drive, and I did not test older macOS releases, bash as the login shell, or the Finder steps (drag and drop, Open in Terminal), which follow Apple’s guide.