How To Prevent Startup Processes from Slowing OSX Login

Dropbox is a wonderful utility. But.....it's a big fat resource hog for about a minute after you login to OSX for the first time after a restart. The larger your dropbox folder, the worse it gets.

A solution I discovered last night is to launch startup processes through AppleScript, instead of having the system launch them automatically. 

Step 1  - Create A Startup Apps Script

Use the AppleScript editor to create a new script. The contents of mine are below. Obviously you'll replace the application names with the applications that you currently want launched at startup. Notice that Dropbox is dead last on this list. The script launches the applications - in the background - with a delay in between. 

do shell script"open -ga 'Alfred 2'"
delay 10
do shell script "open -ga 'Fantastical'"
delay 10
do shell script "open -ga 'TextExpander'"
delay 10
do shell script "open -ga 'Path Finder'"
delay 10
do shell script "open -ga 'TextExpander'"
delay 10
do shell script "open -ga 'Dropbox'"
delay 10

The application name in the script must match the name of the corresponding .app file in the Applications folder. For an app like 1Password, where a helper app is launched that actually lives inside the main app, this won't work.

Dropbox is a great candidate because it launches in a very straightforward way - just the main Dropbox application. 

Step 2 - The App

Save the AppleScript script as an Application into the Applications folder, I called mine StartupApps. 

 

Screen Shot 2013-09-10 at 5.37.27 PM.png

Step 3 - Set App Preferences

Next, check all your apps that launch at startup for a "Launch at Startup" preference, and uncheck it.

If the application has a "helper" application, this preference may be worded as "Keep ____ helper running after application quits". 

Basically, you don't want any of these apps telling the system to do anything when a restart happens.

 

Screen Shot 2013-09-10 at 5.41.16 PM.png

Step 4 - Remove Launch Daemons

Here's where it gets a bit nerdy, but without this step the whole process is pointless. In the Finder, click Go -> Go To Folder and type

~/Library/LaunchAgents/

You'll se a list of plist files in there, some of them will match applications that you've put into your startup script. Drag those files to your desktop - we don't want to delete them just yet in case something goes wrong.

Repeat this process for  

/Library/LaunchAgents/
/Library/LaunchDaemons/ 
/Library/StartupItems/ 

Again - only do this for plist files corresponding to Apps in your startup script, and only do this for applications that are being launched directly from the Applications folder, not some helper application inside the main application. 

Step 5 - Set Login Items

Go to the System Preferences -> Users and find your name in the account list. Go to the "Login Items" tab. Remove any items that match the items in your script. Add a new item that links to your new StartupApps app. 

 

Step 6 - Restart

Now, restart your computer, login and wait for the applications to load one at a time. If there's an error, you'll probably see an error message about "Connection is invalid". I first saw this error because I was trying to launch an application from the script, but there was a LaunchAgent that had already started it. 

 

The Results

My results were extremely good. Since Alfred launches first, I'm able to launch Chrome, my Mail program and begin working while the other apps launch one at a time. If you find that the apps are still overlapping in startup, you can increase the delays in the script. Just open the StartupApps app in the AppleScript editor, edit and re-save.

Here's to more product restarts. 

Previous
Previous

What I Learned - 1/2/14

Next
Next

How To Import Chapter Markers With A Video Into FCPX