Posts Tagged ‘macosx’

Macworld 2009 Puppet Presentation

PuppetSlides from Nigel and my Macworld 2009 presentation are now available online.

 

TextMate on Leopard Command Line Tool Fix

Text MateI quickly noticed that the “mate” command line tool does not work as expected under GNU Screen on Leopard. The error I get is:

mate: failed to establish connection with TextMate.

I suspect this is a side-effect of the Leopard sandbox feature. I’ve found a quick shell alias to be a nice work-around:

alias mate='open -a TextMate.app'

This works inside of GNU Screen, where the mate command line utility does not.

 

Show Password from System keychain

Keychain UnlockedI tried retrieving the password for a wireless network I’d joined sometime in the past. To do this, I went into Keychain Access, selected the System keychain, and asked it to Show Password for the networking in question.

As it turns out, the system keychain is protected with a shared secret which I believe is maintained in /var/db/SystemKey. This is a binary file, so it’s not very easy to pull out the password in a form that can be entered in the dialog box Keychain Access presents.

As a work around, I found a nice hint [1] that uses Keychain Scripting to copy the password to the clipboard. Here’s the Apple Script I’m using. Please not that the first character of a WEP key appears to be $, which should be discarded.

display dialog "What key?" default answer ""
set theKeyName to the text returned of the result
tell application "Keychain Scripting"
	tell keychain "System.keychain"
		set theKeyList to every key
		repeat with k in theKeyList
			if the name of k is theKeyName then
				set TheKeyValue to the password of k
			end if
		end repeat
	end tell
end tell

set the clipboard to TheKeyValue

display dialog "Copied " & length of TheKeyValue & " chars to clipboard." with icon note buttons {"OK"} default button "OK"

[1] 10.4: AirPort and System.keychain password solution