2) Add hourly job:
$RAILS_APP_DIR/script/runner 'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")'
3) My launchd task plist file (yours will vary):
<?xml version="1.0" encoding="UTF-8"?> DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Labelkey>us.boygeni.mysql-session-sweeper< /string> <key>LowPriorityIOkey>/> <key>ProgramArgumentskey> /users/defeated/Sites/rails_apps/boygenius/script/runnerstring> 'ActiveRecord::Base.connection.delete("DELETE FROM sessions WHERE updated_at < now() - INTERVAL 1 HOUR")'< /string> array>RunAtLoad< /key> <true/> <key>StartIntervalkey>3600< /integer> dict> </plist>