The question mark (and disabled popup menu items) indicates that Terminal thinks the working directory is on a remote computer, and therefore you cannot navigate to it in Finder using the popup menu. If you look at the last item in the popup menu (Command-Click on the “proxy” icon) you'll see the computer/host that Terminal thinks the working directory is on. You should find that it is not the computer’s current name.
If you’re using bash (the default shell on macOS), by default it sends a control sequence to the terminal at each prompt to tell Terminal the current working directory. Since control sequences can come from local or remote computers, it sends a “file:” scheme URL including the hostname, and Terminal verifies that the name maps to the current machine. If it doesn’t, Terminal disables the path popup menu items, because they don't correspond to local directories.
You can see the code that sends the control sequence in /etc/bashrc_Apple_Terminal
(or /etc/bashrc
on older versions of macOS).
[Note that if you’re not using bash, or you’ve customized it so the default behavior doesn’t occur, but your shell (or some other program you’re running) is sending control sequences to set the window or tab (icon) title, Terminal will examine it to see if it contains what looks like a pathname, and then it checks whether that corresponds to a valid local pathname. If not, it doesn’t display the window proxy icon at all.]
A scenario where Terminal can fail to recognize that the “file:” URL is on the current host is if you change your network configuration while a shell is running. A common case is putting a portable computer to sleep and moving to another location, then waking it. The local host name and address will have changed, but the shell’s $HOSTNAME
environment variable still has the old host name, and that’s what it sends in the control sequence. To fix this, update the environment variable with:
HOSTNAME=$(hostname)
Another scenario is where you quit Terminal, change network configurations, then open Terminal with Resume enabled. Terminal will restore the windows and tabs, along with the last working directory URL that each was sent. If you run into this case, $HOSTNAME
will be up to date—since it starts a new shell—but Terminal can still have a stale URL until you get the shell to update it again. If displaying the command prompt doesn’t clear up the problem, try changing directories with cd
to get the shell to update it.