Showing posts with label utility. Show all posts
Showing posts with label utility. Show all posts

2007-10-28

Open Finder selection in TextMate

The Pug Automatic posted a nice little applescript you can add to your Finder toolbar that lets you just click the button to open the selected files/folders in TextMate.

Grab it here.

2005-06-04

2005-05-24

Tiger Mail cleanup

When you upgrade from Panther to Tiger, Mail converts the old format mbox files & indexes to .elmx files and spotlight indexing. To be safe, it doesn't delete the old files in case you want to roll back. It also doesn't update them though, so they're kind of worthless spacewasters.

Here's a list of commands to clear out the Panther grime. Make sure you have a backup of ~/Library/Mail, of course. Each line starting with find should be a separate command in a Terminal window.


find ~/Library/Mail -path "*.imapmbox/Cached*" -exec rm -v '{}' ';'

find ~/Library/Mail -path "*.mbox/mbox" -exec rm -frv '{}' ';'

find ~/Library/Mail -path "*.*mbox/content_index" -exec rm -frv '{}' ';'

find ~/Library/Mail -path "*.mbox/table_of_contents" -exec rm -frv '{}' ';'


Running this saved me 3G of disk space.

If you don't make a backup before running this and this nukes your email, it's your fault.

2005-02-24

Nesting of folders has exceeded the recommended limit of 100

If Disk Utility reports Nesting of folders has exceeded the recommended limit of 100, you can find the offending folders by opening a Terminal window and typing

sudo find / -maxdepth 100 -mindepth 100

The last few times I had people report this error to me, they turned out to have an old version of Vapor on their machine.

2005-02-21

TwoFingerScrolling Update

I've gotten some feedback from Joe Stroller with some modifications to the TwoFingerScrolling startup script. I'm also posting a tarball of the updated StartupItem at http://apesseekingknowledge.net/packages/TwoFingerScrolling.tar.gz to make it simpler to use.

These instructions assume that you're comfortable enough using Terminal to edit files with a command line editor like vi or emacs, and that you know how to boot into single user mode and remove the StartupItem if you have a problem.

All you need to do now is

  1. Download the tarball from here.
  2. Extract it
  3. Download the latest version of the kext from Daniel Becker's site here
  4. Put the extracted kext file into the StartupItem folder you got from step 2 above
  5. If it doesn't already exist, create a folder in /Library named StartupItems.
  6. Move the TwoFingerScrolling directory to /Library/StartupItems. If it is not named TwoFingerScrolling exactly, it will not load.
  7. In a Terminal window, edit /System/Library/StartupItems/LoginWindow/StartupParameters.plist and change the line that reads Requires = ("Disks", "SecurityServer"); to Requires = ("Disks", "SecurityServer", "TwoFingerScrolling");. This forces LoginWindow to not start until the new kext is loaded.

You're all set.

For those of you who want to see the new script, here it is:


#!/bin/sh
#
# Load Daniel Becker's modified Trackpad Driver on recent PowerBooks and iBooks
# This is released under a BSD license.
# By J. P. Block
# and Joe Stroller

. /etc/rc.common

# http://www.macdevcenter.com/pub/a/mac/2003/10/21/startup.html says:
# The StartupItems specification requires that the executable file
# has the same name as the subdirectory that contains it and that the
# executable is in the root level of subdirectory.
#
# But since Joe User might choose to run this script manually
# (for testing or otherwise), we can't rely on $PWD and have
# to define the /path/to/the.kext programatically

MYDIR="${0%/*}"

if [ "$UID" != "0" ]
then
echo "Only root can load or unload kernel modules."
exit 1
fi

# Check to make sure we have a patched driver to load, or bad things will
# happen when we unload the original driver and can't find the patched driver
# to replace it.

if [ ! -d "$MYDIR/AppleADBMouse.kext" ]; then
ConsoleMessage "No patched AppleADBMouse.kext found."
exit 0
fi

# We have to source Apple's /etc/rc.common in order to get the ConsoleMessage
# function, but it breaks the below:
#
#if [ -z "$1" ]
#then
# echo "ERROR! This script requires a commandline argument, silly!"
#fi

# You don't have to be drunk to write Bash scripts on a Macintosh, but it helps!
#
ConsoleMessage ""
ConsoleMessage ' * If you see a message below saying "$1: unbound variable"'
ConsoleMessage " * It probably means $0 "
ConsoleMessage ' * has been called without a parameter (like "start" or "stop")'
ConsoleMessage " * "
ConsoleMessage " * If this message annoys you then please bitch to (IE file a"
ConsoleMessage " * bug report with) Apple, compaining that their /etc/rc.common"
ConsoleMessage " * functions break standard Bash syntax like: "
ConsoleMessage ' * if [ -z "$1" ] ; then echo "missing parameter" ; fi '
ConsoleMessage ""

case "$1" in
start)

ConsoleMessage "Loading Two Finger Scrolling"
# make sure the permissions are correct on it before we load it
chown -R root:wheel $MYDIR/AppleADBMouse.kext
kextunload -b com.apple.driver.AppleADBMouse && kextload $MYDIR//AppleADBMouse.kext
;;
stop)

ConsoleMessage "Stopping Two Finger Scrolling"
kextunload $MYDIR/AppleADBMouse.kext && kextload /System/Library/Extensions/AppleADBMouse.kext
;;
*)
echo "Neither \"Start\" nor \"Stop\" are spelled \"$1\""
;;
esac

exit 0

2005-02-15

How to set up a local fink repository

I have one of our G5s set up to be the apt repository for the machines at my day job. It's running 10.3 client, so I added a file, /etc/httpd/users/fink with the following contents:


Alias /fink /sw/fink

<Directory /sw/fink>
Options Indexes FollowSymLinks
</Directory>


I did this as a separate user file rather than edit /etc/httpd/httpd.conf to prevent future OS updates from breaking my apt repository. If you're running the repository on OS X Server, I believe you need to put the file in /etc/httpd/sites, and the file name may need to be tweaked to avoid confusing the GUI tools.

To get client machines to use the repository, I added the following lines at the beginning of /sw/etc/apt/sources.list (change finkmachine to the machine name of your repository):


deb http://finkmachine.local./fink stable main crypto
deb http://finkmachine.local./fink unstable main crypto


It was cool to discover that apt would deal with rendezvous names painlessly.

Now all you have to do is remember to do fink scanpackages after you build anything new on the repository, and your clients can just apt-get update;apt-get upgrade periodically to stay up to date.

Creative Commons License

This work is licensed under a Creative Commons License.
Copyright 2007-2010, Joseph P. Block, Some Rights Reserved.

Creative Commons Logo