Accueil > Système > Update locate database on OS X (updatedb)

Update locate database on OS X (updatedb)

28/01/2014 Categories: Système Tags: , , , ,

Source: myunster.com

In order to update « locate » database on OS X, some people suggest create a symlink:

sudo ln -s /usr/libexec/locate.updatedb /usr/local/bin/updatedb

However, this method can create an erroneous output if you are in directory with specific permission e.g.

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
find: .: Permission denied

The better method would be create a bash script /usr/bin/updatedb:

  #!/bin/bash
  pushd . > /dev/null
  cd /usr/libexec
  echo "Updating locate database..."
  sudo ./locate.updatedb
  echo "Updating complete!"
  popd > /dev/null

Make it executable: sudo chmod +x /usr/bin/updatedb

Now you can just run «sudo updatedb», in order to update «locate» database.

Print Friendly, PDF & Email

Related Post

Categories: Système Tags: , , , ,
Les commentaires sont fermés.