0

I've got MacBook from work and try to make it work similar to Linux. This is my config for history in bash:

# When the shell exits, append to the history file instead of overwriting it
export HISTCONTROL=ignoreboth
export HISTSIZE=80000
export HISTFILESIZE=100000
export HISTTIMEFORMAT="%Y-%m-%d %T "

# append to the history file, don't overwrite it
shopt -s histappend

# After each command, append to the history file and reread it
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"

It's part of my dotfiles repo.

The setup suppose to work so commands from all terminal tabs/windows are added to history. This works perfect on Linux. But on Mac in some tabs history command only return one entry (the history command I just executed) and everything breaks. fzf show error:

`__fzf_history__`-bash fc: history specification out of range.

Can you explain what is happening and how to fix history in bash on MacOS?

6
  • 1
    To confirm, you switched your shell from zsh (the default on macos) to bash? Which bash, the system one which is an antique 3.2? Or one from homebrew or something? Commented Sep 3 at 14:43
  • Which dot-file did you add those settings to? And you said it doesn't work for some tabs - is that change recent? If so you'll need to either close & reopen those, or manually source the newly modified dot-file. Commented Sep 3 at 16:14
  • @tink The tabs were open after the code was added. And history doesn't work in some of the tabs. I have terminal with 4 tabs. Commented Sep 3 at 17:00
  • @muru I use default system bash. I forget to check new version from Homebrew. Will install and check if this fix the issue. Commented Sep 3 at 17:01
  • 1
    @waltinator I already use what is the answer to the question you've linked. Commented Sep 4 at 11:33

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.