{"id":18,"date":"2008-03-21T11:09:48","date_gmt":"2008-03-21T15:09:48","guid":{"rendered":"http:\/\/hoolihan.net\/blog-tim\/?p=18"},"modified":"2008-03-21T11:12:57","modified_gmt":"2008-03-21T15:12:57","slug":"startup-scripts-on-os-x","status":"publish","type":"post","link":"http:\/\/hoolihan.net\/blog-tim\/2008\/03\/21\/startup-scripts-on-os-x\/","title":{"rendered":"Startup Scripts on OS X"},"content":{"rendered":"<p>I have a set number of programs that I usually want to start when my<br \/>\nmacbook pro boots up.  But sometimes I want to boot in a hurry and all<br \/>\nthe startup items bother me.  I came up with a solution I thought I&#8217;d<br \/>\npass on.<\/p>\n<p>I load Aquamacs automatically, as I use it for a terminal and several<br \/>\nother things.  I wrote a ruby script that uses the applescript<br \/>\nlibraries to ask If want to start the usual applications.<\/p>\n<p>Then I call that script from Aquamacs as it loads.  If I say no, then<br \/>\nonly Aquamacs is loaded on boot.  Otherwise, all the apps load.<\/p>\n<p>First, install appscript&#8230;<\/p>\n<p><code>#sudo gem install appscript<\/code><\/p>\n<p>Then, put the following in a script file, I used ~\/scripts\/<br \/>\nload_programs.rb.  Change the programs to match what you want.<\/p>\n<p><code>#!\/usr\/bin\/env ruby<br \/>\nrequire 'rubygems'<br \/>\nrequire 'appscript'<br \/>\nrequire 'osax'<br \/>\ninclude OSAX<br \/>\ninclude Appscript<\/code><\/p>\n<p><code>start=[ \"Firefox\",\"Mail\",\"iTunes\",\"Microsoft Entourage\"]<br \/>\nanswer = osax.display_dialog(\"Do you want to launch #{start.join(',<br \/>\n')}\",<br \/>\n:buttons =&amp;gt;<br \/>\n[\"Yes\",\"No\"], :default_button =&amp;gt; \"Yes\")<br \/>\nif answer[:button_returned] == \"Yes\" then<br \/>\nstart.each{|a| app(a).activate}<br \/>\nend<\/code><\/p>\n<p>Then, at the bottom of your ~\/.emacs file put:<\/p>\n<p><code>(shell-command \"ruby ~\/scripts\/load_programs.rb\")<\/code><\/p>\n<p>All the benefits of startup applications, only if you want them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;d pass on. I load Aquamacs automatically, as I use it for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,18,16],"tags":[],"class_list":["post-18","post","type-post","status-publish","format-standard","hentry","category-os-x","category-programming","category-ruby"],"_links":{"self":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts\/18","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/comments?post=18"}],"version-history":[{"count":0,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/posts\/18\/revisions"}],"wp:attachment":[{"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/media?parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/categories?post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hoolihan.net\/blog-tim\/wp-json\/wp\/v2\/tags?post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}