Skip to content

Instantly share code, notes, and snippets.

@folke
Created October 1, 2020 12:34
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save folke/cded312c972ff3164dd405aad423b00f to your computer and use it in GitHub Desktop.
Save folke/cded312c972ff3164dd405aad423b00f to your computer and use it in GitHub Desktop.
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

👍 ta!

@rodrigobdz
Copy link

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