2

under the latest macos

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15.6
BuildVersion:   19G73

i am using the latest bash (installed via brew)

$ $SHELL --version
GNU bash, version 5.0.18(1)-release (x86_64-apple-darwin19.5.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

and bash is defined as the default shell (chsh -s /usr/local/bin/bash + reboot)

$ which $SHELL
/usr/local/bin/bash

$ cat /etc/shells | tail -n 1
/usr/local/bin/bash

to customize bash, i have ~/.inputrc

$ ls -l ~/.inputrc
-rw------- 1 foo staff 1432 Jan 21  2020 /Users/foo/.inputrc

that holds the following

set completion-ignore-case on
"\e[B": history-search-forward
"\e[A": history-search-backward

i used to be able to reverse-search using case-insensitive, but now it stopped working.

even tried to run set completion-ignore-case on and bind 'set completion-ignore-case on' directly in the terminal but it did not solve my issue.

  1. is there a bug in the bash version that i am using?
  2. how can i tell whether bash honors ~/.inputrc?
  3. how do you recommend to debug the issue?
5
  • 1
    Are you sure that you are running bash ?? - with macOS 10.15 the default is now zsh - which can be change back to bash Commented Jul 29, 2020 at 14:07
  • @HighPerformanceMark: it does, please see my update to the question
    – Mr.
    Commented Jul 29, 2020 at 14:28
  • @ReneLarsen: 100% sure, please see my update to the question
    – Mr.
    Commented Jul 29, 2020 at 14:32
  • What does "stopped working" mean? The key combination does not pop the search? It doesn't find anything? What key do you have ESC-[-B bound to in the keyboard profile? By default it's the up-arrow on the keyboard. If you prefix hitting the key with ^V, does the shell display what you would expect? What terminal are you using? Commented Jul 29, 2020 at 15:27
  • (1) What does echo $BASH_VERSION show? (2) What does echo $INPUTRC show? Commented Feb 28, 2022 at 11:43

4 Answers 4

2

after examining the issue under linux, i realized that the issue is not macos specific.

searching the internet harder, i found the solution

you can't get this feature in BASH at present because this feature hasn't been built yet into vi or emacs mode. As I commented above completion-ignore-case only applies to completion, not to isearch

~10 years after the accepted answer, it seems that it is still the case.

references:

1
  • 2
    Which statement flies in the face of what you claimed above... "i used to be able to reverse-search using case-insensitive, but now it stopped working", so which is it? Commented Jul 29, 2020 at 15:48
1

SOLVED! macOS Catalina version: 10.15.7

According to the readline manual, ~/.inputrc should essentially, auto-initialize by bash.

This didn't initially work for me. What finally worked was adding the bind -f ~/.inputrc to ~/.bash_profile. Also, remember to install readline using brew install readline

I also tried without success:

  1. Upgrading to bash 5 using brew - did Not auto-initialize ~/.inputrc
  2. Compiling locally a version of bash5 using brew install --HEAD bash - did Not work
  3. Adding the bind command to ~/.bashrc - did not work on bash3 or bash5
1
  • does it let you use case-insensitive words in history search? any link to the readline manual that you read?
    – Mr.
    Commented Nov 18, 2021 at 17:13
1

Now that zsh is the default shell, you can add this to ~/.zshrc to get .inputrc up/down functionality.

bindkey "\e[A" history-beginning-search-backward
bindkey "\e[B" history-beginning-search-forward

For more information, see My .zshrc file on Mac (adapted from .bashrc and .inputrc).

0

Don't have enough reputation to comment: but a possible issue is that when readline is installed by Homebrew it is installed as keg only so you need to brew link --force readline to make it visible to bash. This worked for me. Unfortunately, the Homebrew bash bottles only use the default configure options so it is not possible to use the readline included with the bash source with ./configure --without-installed-readline which is what I have always done until I decided to use Homebrew.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .