Feed on
Posts
Comments

Speed-up your Mac

As a Mac administrator I’m often asked how to speed-up a Mac. This little post shows some tricks. But first of all you should know how a Mac starts:

  1. After turning it on, the Mac reads NVRAM variables.
  2. Then it boots from harddrive.
  3. The last thing is your profile with your desktop.

NVRAM

So where can we speed-up things? Lets start with NVRAM. In NVRAM are some variables like the startup device, your volume, keyboard language etc. Sometimes theses values get corrupted or lost or you may have them deleted by pressing CMD+ALT+P+R during startup to fix some problems. In this case the startup device is not defined and the Mac searches for a bootable device everytime you turn it on. To set your OS X partition as boot device, just go to system settings, startup device and select your OS X installation. You can verify this in terminal:

# nvram -p

This should give you at least this:

efi-boot-device    <array><dict><key>MemoryType</key><integer size="32">0xb</integer><key>StartingAddress</key><integer size="64">0xffc21000</integer><key>IOEFIDevicePathType</key><string>HardwareMemoryMapped</string><key>EndingAddress</key><integer size="64">0xffeb3fff</integer></dict><dict><key>IOEFIDevicePathType</key><string>MediaFirmwareVolumeFilePath</string><key>Guid</key><string>2B0585EB-D8B8-49A9-8B8C-E21B01AEF2B7</string></dict><dict><key>IOEFIBootOption</key><string>HD</string></dict></array>%00

The above is from my iMac 11.1

Booting

After the startup device has been found your Mac loads the kernel, the kernel modules and system services. This is where the Mac needs most of its booting time. A modern OS X like Snow Leopard caches its kernel modules preloaded for your architecture (32bit or 64bit). These caches are handled by the OS but sometimes not everything is cached. Just type

sudo update_dyld_shared_cache -root /

into terminal to update them.

Wrong file permissions is also a reason for a slow booting Mac. The more software you have installed the higher is the chance that your permissions need to be fixed. You can use Disk Utility for that but I prefer terminal as you get a better output:

sudo diskutil repairpermissions /

If your Mac installation is not the newest one you may have tested a lot of software. Some of them may have installed system services which are still present after deleting the app. In terminal, you can check the following directories for such software: /Library/StartupItems/, /Library/LaunchAgents/ and /Library/LaunchDaemons/:

# cd /Library/StartupItems/
# ls -lha
total 0
drwxr-xr-x   3 root  wheel   102B  9 Dez 21:23 .
drwxrwxr-t+ 59 root  admin   2,0K  7 Jan 22:21 .
drwxr-xr-x   5 root  wheel   170B  9 Jan 19:59 EyeConnect

This shows us that EyeTV has installaed a service which runs at every boot. If you don’t use such software anymore, just delete it by typing

# sudo rm -r EyeConnect

But be careful as sudo rm -r can delete your whole system when used wrong!

# cd /Library/LaunchAgents/
# ls -lha
total 0
drwxr-xr-x   2 root  wheel    68B  5 Okt 06:42 .
drwxrwxr-t+ 59 root  admin   2,0K  7 Jan 22:21 ..
# cd /Library/LaunchDaemons/
# ls -lh
total 8
-rw-r--r--  1 root  wheel   520B  8 Dez 02:58 com.vmware.launchd.vmware.plist

In the above example you can see a VMWare daemon which can be removed (if no longer needed) with rm, too.

Sometimes a Mac needs to check / correct disk integrity. This is the case when you have turned off your Mac by just holding the power key. You should force a disk check after that. To do so, start your Mac in single user mode by pressing CMD + s directly after turning it on. You’ll be presented with a nice terminal:

# /sbin/fsck -fy

does the trick. This fixes some minor errors, too. To end single user mode, type

# reboot

User profile

After your login the Mac looks for per-user startup items. These can be configured in System settings -> Accounts -> Login Items or like above in a directory: ~/Library/LaunchAgents

# cd ~/Library/LaunchAgents/
# ls -lha
total 32
drwx------   6 kai  staff   204B 25 Jan 21:49 .
drwx------+ 48 kai  staff   1,6K  3 Feb 19:13 ..
-rw-r--r--   1 kai  staff   886B 25 Nov 18:47 com.apple.CSConfigDotMacCert-itunes@me.com-SharedServices.Agent.plist
-rw-r--r--   1 kai  staff   801B 26 Dez 11:37 com.google.keystone.agent.plist
-rw-r--r--   1 kai  staff   606B 25 Jan 21:49 de.metaquark.appfresh.plist
-rw-r--r--@  1 kai  staff   586B 25 Nov 20:43 ws.agile.1PasswordAgent.plist

These items are loaded everytime you log in even when you don’t use the software behind these services. Again, if there is something you don’t longer need, delete it using rm.

I was able to reduce boot time from 18 to 10 seconds on my MacBook (SSD). Have fun 🙂

4 Responses to “Speed-up your Mac”

  1. Björn says:

    Nice tips. I will try them at work – if something breaks, I know, where you work 😉

  2. Maria peter says:

    Removing unwanted application is the most effective way to boost the speed of mac but there are other critical reasons that hampers the speed of mac like unwanted duplicate files these can reduce the mac speed substantially .

  3. Paulus says:

    Puuuh derzeit bin ich auf der Suche nach eine SSD und werde einfach nicht wirklich schlau aus der Materie. Mein Macbook Pro 2011 “braucht” eine solche Festplatte, damit ich mich beim Start von Photoshop und Firefox nicht mehr zu Tode ärgern muss – jetzt ist der Markt aber so undurchsichtig und OSX hat keine TRIM unterstützung, dass ich Hilfe brauche. Hat vielleicht jemand einen Tipp bzw. welche SSD habt ihr verbaut? Habe hier die Crucial Real SSD C300 und die Samsung SSD 470 für jeweils unter 200 Euro gefunden und bin von beiden nicht abgeneigt. Naja ich klinge verzweifelt und bin daher natürlich für jede Hilfe dankbar ^^

  4. Kai says:

    Ich habe gute Erfahrungen mit den Intel SSDs gemacht. TRIM-Unterstützung für nicht-Apple-SSDs bekommst Du mit dem Trim Enabler: http://www.groths.org/?p=308

Leave a Reply