Skip to content

Instantly share code, notes, and snippets.

@eegrok
Created April 8, 2014 23:40
Show Gist options
  • Save eegrok/10209444 to your computer and use it in GitHub Desktop.
Save eegrok/10209444 to your computer and use it in GitHub Desktop.
locate.updatedb on osx as root instead of nobody user -- indexes home directory files
# comment out this region to index as root according to:
# http://apple.stackexchange.com/questions/84532/how-can-i-search-my-entire-drive-for-a-file-without-getting-recursively-stuck-in/84556#84556
# if [ "$(id -u)" = "0" ]; then
# rc=0
# export FCODES=`mktemp -t updatedb`
# chown nobody $FCODES
# tmpdb=`su -fm nobody -c "$0"` || rc=1
# if [ $rc = 0 ]; then
# install -m 0444 -o nobody -g wheel $FCODES /var/db/locate.database
# fi
# rm $FCODES
# exit $rc
# fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment