2
I am using the default settings for Terminal, but when I create a new tab my working directory is always set to my home folder instead of the current working directory of the previous tab.
Here's an image of my Terminal Preferences:
As you can see in the General settings, "New tabs open with:” is set to “Same Working Directory". That does not seem to be working. I think I remember this working in older versions of Terminal.
My default login shell is set to /bin/zsh
, and I have no ~/.zshrc
.
I would like to be able to solve this issue without installing something like oh-my-zsh
or having to add something to ~/.zshrc
. This should work without any of that. (At least it does in iTerm2.)
Update: This works if my default login shell is
/bin/bash
. I believe this has something to do with the file/etc/bashrc_Apple_Terminal
, which sets the proper escape sequences for the shell to notify Terminal of the current working directory. There is no equivalent file forzsh
and the/etc/zshrc
file is very minimal. – Chase Stubblefield – 2015-11-20T23:31:50.363Different sessions shouldn't talk to each other, unless it is handled on the terminal emulator level (which is not the case here, unless you convince Apple to do that), or you write some data to disk and load them later. I never bothered to look into
/etc/bashrc_Apple_Terminal
, but I know it writes session files into~/.bash_sessions
, from which it can load path from a former session (I suppose). You can do something similar in Zsh, but the requirement of not modifying~/.zshrc
(I assume by that you are excluding all runcoms) is simply unrealistic. – 4ae1e1 – 2015-11-21T02:28:59.737@4ae1e1: This question is about communicating the current working directory to Terminal (via escape sequences) and is unrelated to the shell command history. – Chris Page – 2015-11-28T13:11:30.477