Tuesday, January 12, 2010

To:Mail.app From:MacHackShack.com Subject:Advanced keyword searching with Mail.app and spotlight

Thanks to @rands on twitter, I now realize you can use the gmail-style keyword text search queries in mail (Command-Option-F). This technique also works in spotlight.

to:someone from:someone subject:something
The "someone" part seems to work with full names or email addresses.

The only confusing thing is the mail search bar should switch to "Entire message" when you're using a keyword-style search rather than the "From", "To" or "Subject" buttons.

It's a very limited syntax and not well publicized but welcome anyway cause what's there works. These tests done in Snow Leopard 10.6.2 and Mail.app 4.2.

Wednesday, January 06, 2010

How to restart a hung Finder in Mac OS/X without rebooting

Warning this is HIGHLY UNAUTHORIZED. Proceed at your own risk.
So: save everything first before going on.

Okay - to do this, it's pretty basic. We're actually not sending it the kill signal, instead telling it to restart itself or in unix signal parlance: SIGHUP. I learnt this doing some BSD coding on HP/UX systems years ago.

So first, we need the Finder's pid. This will get it:
ps -e | grep Finder | grep -v grep | cut -c1-6

And then pass that to the kill command with -sighup switch:
kill -sighup `ps -e | grep Finder.app | grep -v grep | cut -c1-6`

This will clobber Finder and it will reopen fresh(ish) as a daisy.

Put it in a script for reuse call this restartfinder.sh
kill -sighup `ps -e | grep Finder.app | grep -v grep | cut -c1-6`
chmod +x restartfinder.sh

And you're done.