Mysql Gem on Leopard

After getting a whole lot of errors, I found the only way I could get this gem to work is the following:

-Install x86 version of mysql

-Install Gem like the following: sudo gem install mysql — –with-mysql-dir=/usr/local/mysql –with-mysql-config=/usr/local/mysql/bin/mysql_config –remote

I hope that helps…

Startup Scripts on OS X

I have a set number of programs that I usually want to start when my
macbook pro boots up. But sometimes I want to boot in a hurry and all
the startup items bother me. I came up with a solution I thought I’d
pass on.

I load Aquamacs automatically, as I use it for a terminal and several
other things. I wrote a ruby script that uses the applescript
libraries to ask If want to start the usual applications.

Then I call that script from Aquamacs as it loads. If I say no, then
only Aquamacs is loaded on boot. Otherwise, all the apps load.

First, install appscript…

#sudo gem install appscript

Then, put the following in a script file, I used ~/scripts/
load_programs.rb. Change the programs to match what you want.

#!/usr/bin/env ruby
require 'rubygems'
require 'appscript'
require 'osax'
include OSAX
include Appscript

start=[ "Firefox","Mail","iTunes","Microsoft Entourage"]
answer = osax.display_dialog("Do you want to launch #{start.join(',
')}",
:buttons =>
["Yes","No"], :default_button => "Yes")
if answer[:button_returned] == "Yes" then
start.each{|a| app(a).activate}
end

Then, at the bottom of your ~/.emacs file put:

(shell-command "ruby ~/scripts/load_programs.rb")

All the benefits of startup applications, only if you want them.

Get Name of Current Directory

The following gets you the full path…

pwd

example: /home/tim/my_project

What if you just want my_project? This comes in handy when writing
backup scripts for coding directories.

pwd | sed 's/.*\///g'