I have moved to macbook pro from linux recently and I do have quite a big bash history (over 200000 commands).
Unfortunately while using bash history in macOS I have noticed that if I pipe history command output to any external command (e.g. history|grep blablabla) things become quite slow.
Anyone else noticed the same behavior or may be can suggest a fix?
My setup:
$ uname -a
Darwin ak-mac 25.0.0 Darwin Kernel Version 25.0.0: Wed Sep 17 21:42:08 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T8132 arm64
$ bash --version
GNU bash, version 5.3.3(1)-release (aarch64-apple-darwin25.0.0)
$ set|grep ^HIST
HISTFILE=/Users/scz/.bash_history
HISTFILESIZE=1000000000
HISTSIZE=1000000000
HISTTIMEFORMAT='%F %T '
$ echo $HISTCMD
204604
This works pretty fast:
$ time history
.......
real 0m0.670s
user 0m0.226s
sys 0m0.200s
This too:
$ time wc -l .bash_history
243708 .bash_history
real 0m0.027s
user 0m0.019s
sys 0m0.008s
And if I pipe history command I get the problem:
$ time history|wc -l
204609
real 0m51.708s
user 0m15.449s
sys 0m36.916s
P.S. The workaround I don't really like:
$ time bash -i -c "set -o history; history" |wc -l
204944
real 0m0.459s
user 0m0.331s
sys 0m0.325s
Thanks a lot for your help!
bash(/bin/bash)?/bin/bash). I didn't install it myself (onlybash-completion@2via brew)/bin/bashisGNU bash, version 3.2.57(1)-releaseor similar), assume installing bash-completion automatically installed bash as well. But I doubt this is the issue. As a side note, I switched to Atuin a while ago which makes handling of large histories way easier.bashthat you installed, maybe without realizing it. Please try the command with the full path.