Prezto: `$HISTFILE` doesn't set `.zhistory` after upgrade to macOS Catalina

Created on 10 Oct 2019  路  3Comments  路  Source: sorin-ionescu/prezto

Description

At first it seemed that history-substring-search and autosuggestions were not work, but the value of $HISTFILE was not set .zhistory.

$ echo $HISTFILE
$ /Users/<user>/.zsh_history

I think this is because /etc/zshrc is loaded after upgrading macOS Catalina.
However, since this file cannot be edited by root, Can't be solved.

Expected behavior

Command history needs to be written to .zhistory.

Actual behavior

In addition to .zhistory, a .zsh_history file will be created.
The previous history will not be read.

Steps to Reproduce

Just upgrade macOS.

Versions

  • Prezto commit: 2873885
  • ZSH version: zsh 5.7.1 (x86_64-apple-darwin18.2.0)
  • OS information: macOS Catalina (10.15) Build: 19A583

Most helpful comment

Commit 43214f1aed1723ab5b18cd73ce0019b5c6bb9848 introduced the allowance of a previously set HISTFILE value. As that variable is set in /etc/zshrc since Catalina, its value $HOME/.zsh_history takes precedence over the one used in .zprezto/modules/history/init.zsh since then.

As a workaround, add the following snippet to .zshrc just before Prezto is sourced:

#
# Workaround for: https://github.com/sorin-ionescu/prezto/issues/1744
#
export HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file.

Above snippet sets HISTFILE to $HOME/.zhistory which again is used in .zprezto/modules/history/init.zsh instead of the value previously set in /etc/zshrc.

All 3 comments

Commit 43214f1aed1723ab5b18cd73ce0019b5c6bb9848 introduced the allowance of a previously set HISTFILE value. As that variable is set in /etc/zshrc since Catalina, its value $HOME/.zsh_history takes precedence over the one used in .zprezto/modules/history/init.zsh since then.

As a workaround, add the following snippet to .zshrc just before Prezto is sourced:

#
# Workaround for: https://github.com/sorin-ionescu/prezto/issues/1744
#
export HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file.

Above snippet sets HISTFILE to $HOME/.zhistory which again is used in .zprezto/modules/history/init.zsh instead of the value previously set in /etc/zshrc.

Interesting. I鈥檓 not sure if we want to override this or not since was a mechanism that let users override the setting if they wanted to.

Interesting. I鈥檓 not sure if we want to override this or not since was a mechanism that let users override the setting if they wanted to.

I would prefer some setting in the history module that would allow me to configure whether any predefined value would take precedence or not. Like:

zstyle ':prezto:module:history:histfile:path' allowoverride 'yes'
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sjackman picture sjackman  路  6Comments

TsichiChang picture TsichiChang  路  3Comments

brycekellogg picture brycekellogg  路  4Comments

voanhduy1512 picture voanhduy1512  路  3Comments

lokesh-krishna picture lokesh-krishna  路  5Comments