Can't increase Mac OSX bash shell history length

Solution 1:

You also need to set HISTSIZE=10000000.

HISTFILESIZE determines the number of lines to keep in the history file while HISTSIZE determines the number of lines to keep in memory. Both default to 500

Execute echo $HISTFILESIZE $HISTSIZE before you make the change and then again after. You should see 10000000 500 first then 10000000 10000000 after.

Solution 2:

You need to export HISTSIZE and HISTFILESIZE environment variables in your ~/.bash_profile file.

Add following lines in your ~/.bash_profile:

# history size
export HISTFILESIZE=1000000
export HISTSIZE=1000000