Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using `apropos` on macos rebuilds the whatis database every time. Fish shell uses apropos for command completion.
# Fixes extremely slow apropos command on macos
# Using `apropos` on macos rebuilds the whatis database every time.
# Fish shell uses apropos for command completion.
# Simply add the file below to `~/.config/fish/conf.d` to fix the issue
set db ~/.whatis.db
function apropos_update
echo "Updating apropos / whatis database at $db"
man --path | tr ":" " " | xargs /usr/libexec/makewhatis -o $db
end
function apropos
[ -f $db ] || apropos_update
/usr/bin/grep -i "$argv" $db
end
function whatis
[ -f $db ] || apropos_update
/usr/bin/grep -i "\b$argv\b" $db
end
@montaro
Copy link

montaro commented Dec 9, 2020

Thanks a million!

@folke
Copy link
Author

folke commented Dec 10, 2020

@montaro
Copy link

montaro commented Dec 10, 2020

Thanks again @folke you saved me from migrating to Zsh :)

@VIVelev
Copy link

VIVelev commented Dec 18, 2020

Yeah, same. Thanks @folke!

@massyah
Copy link

massyah commented Jan 13, 2021

Thanks !

@chrisfcarroll
Copy link

chrisfcarroll commented Jan 27, 2021

👍 ta!

@rodrigobdz
Copy link

rodrigobdz commented Jun 22, 2021

Works! Thank you @folke!

@folke
Copy link
Author

folke commented Jun 22, 2021

@rodrigobdz this has been merged a while back and has since been released, so you should no longer need this if you're using the latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment