0

Since OSX changed the default shell to zsh I have been unhappy with my iTerm2 setup.

Initially I noticed that my ~/.zschrc file was not being sourced when a new shell was opened.

Following the guidance here

https://apple.stackexchange.com/questions/115598/how-to-set-an-iterm2-startup-command

and here

Why do you need to source .zshrc for every new shell in iTerm?

It seemed like the solution add source ~/.zscshrc to the following

Preferences -> Profiles -> Select Default Profile(default profile will be starred) -> General -> Command -> Select Login Shell -> Send text at start:

I have been using this solution for many months now and regularly find it annoying and it fails.

When a new terminal is opened I often begin issuing commands.

For example sake assume I issue the command "remote" (alias for ssh'ing into a remote machine)

The command I issue often gets mangled with the Send text at start command, breaking both the sourcing of the .zschrc and my command.

Here is some sample output of my opening a new termnal and trying to issue commands

Last login: Fri Jan 24 11:42:10 on ttys007
rsource ~/.zschrc
simon@Simons-MacBook-Pro ~ % rsource ~/.zschrc
zsh: command not found: rsource
xxxx@xxxxx-MacBook-Pro ~ % emote

Here you can see the "r" from my "remote" command has got mangled with the sourcing of the .zshrc file.

This happens frequently and on occasion many times in a row when I am busy with some urgent task.

Does anyone else suffer from this problem and is there a solution or better way I should be sourcing my ~/.zschrc file?

Simon
  • 38
  • 4

1 Answers1

1

An interactive Zsh sources the file $ZDOTDIR/.zshrc on startup, where ZDOTDIR defaults to your home directory. If you want to source a different file instead (in your case with name .zschrc), create a file ~/.zshrc with the content

. ~/.zschrc
user1934428
  • 19,864
  • 7
  • 42
  • 87
  • I am not sure how I ended up with the .zschrc file name.. glad I asked though, it was killing me, funny thing is every time I went to edit the file I would type vim .zshrc and get annoyed because I thought zsh had named the file weird! stupid me for not checking. – Simon Jan 24 '20 at 13:48