I am setting up my first MacBook. I copied by .bash_aliases
file from my Linux Mint. After that, I can not open Terminal with a bash session. I just see a black screen and bash taking 100% of my CPU.
I found that the problem is HISTSIZE=-1
Why does bash fall into an infinite loop? And how do I allow unlimited history?
echo $SHELL
(/bin/bash). There is no old history at all. This is a new MacBook. – Eugen Konkov Jul 18 '23 at 20:18.inputrc
,.profile
,.bashrc
,.bash_aliases
. I removed all not required content from them. Also I tested that 100% CPU usage was caused only byHISTSIZE=-1
line. When I comment it out, all works as expected. When I asked the question the.bash_history
file does not exists at all. As of now it is 70 bytes. Yes, only couple of commands there. – Eugen Konkov Jul 18 '23 at 20:57HISTSIZE
with values less than zero are applicable to Bash 4 and above. If you look at the man page on your machine (man bash
) you see it makes no reference to this (v3.2), but the current Bash version (v5.2) does. You were probably using a newer Bash on Mint. If you update Bash, it should work fine. – Allan Jul 18 '23 at 21:22$ bash --version bash --version GNU bash, version 5.2.15(1)-release (x86_64-apple-darwin22.1.0) Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
– Eugen Konkov Jul 18 '23 at 21:42/bin/bash
which is included with macOS. That version is 3.2. What you got withecho $SHELL
. If you have Bash 5.2 installed, you need to change the user shell (chsh
) to the version/location where you updated it (Homebrew, I’m guessing?). – Allan Jul 18 '23 at 21:56/bin/bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin22) Copyright (C) 2007 Free Software Foundation, Inc. $ which bash /usr/local/bin/bash
Thank you, Allan – Eugen Konkov Jul 19 '23 at 15:26