Setup locate command on Mac OS X

Posted by Mike on February 28, 2009

One of the commands that I immediately missed when I started using OS X for my development environment was the locate command. It is very helpful to be at a command prompt and type:

locate mysql

and have it return a list of every file and directory with mysql in them. It is very fast and is great for chaining with other shell commands. In order for it to work it needs a local file database and it needs to update the database periodically to keep up with the changes made on the system. So my goal with these instructions is a quick way to get locate to work and have it update once a day to keep up with everything.

1. Open a Terminal
2. type: sudo /usr/libexec/locate.updatedb

Once it’s finished running, the locate command will work. That same command needs to be run anytime you want the file database updated. I schedule this to run daily with cron.

1. type: sudo crontab -e
2. add this line to the file, save, and exit

30 20 * * * /usr/libexec/locate.updatedb

What this says is run this command everyday at 8:30 pm. You can adjust this time to what ever is most convenient. It’s best if this is a time when you expect the machine to be on but not in heavy use, as it will make it slow for a few minutes while it runs.

Now the locate command should be working and automatically updating itself for file changes everyday. If you decide to change the time that it runs, just follow the second set of steps again and it will overwrite the existing settings. If you’d like to dig deeper into the crontab file for more advanced scheduling options type:

man 5 crontab

Moving On

Posted by Mike on February 08, 2009

I have accepted a position at UCLICK as a software engineer. They are a digital content provider and syndication company that specializes in both the online and mobile device spaces. They are a Linux and Open Source shop that has been transitioning to Ruby over the last couple years moving from Apache/mod_perl to Ruby on Rails. I will be working with some very smart people that are passionate about technology and the work that they do.

Anyone who knows me will know that this is as much about coming back as it is moving on. I was one of the founding members of the company back in 1999 as we tried to establish ourselves during the dotcom boom. I designed and built much of the infrastructure that allowed the company to grow it’s online traffic. My roll has changed and I will be focused more on development rather than the network and systems. I’m excited to be working in an Open Source shop again and I’m looking forward to helping the company grow and enhance it’s product line.