Alastair’s Place

Software development, Cocoa, Objective-C, life. Stuff like that.

You Don’t Need to Restart

The installer for the new version of MYOB AccountEdge Plus (previously known as MYOB Accounting Plus) restarts the machine.

It’s been irritating me for a while that a lot of software, particularly that written by companies who normally deal with PC software, unnecessarily restarts the machine once it has been installed.

Anyone writing an installer for Mac OS X should take note: You don’t need to restart the machine! In particular:

  • You don’t need to restart after installing an ordinary application. If your application isn’t showing up in Launch Services’ database, you might want to read about Application Registration, but ideally your installer should handle that for you.
  • You normally don’t need to restart after installing a shared library in /Library or /usr/local/lib, provided you handle the case where some existing programs are using an older version. Unless you are using shared memory or IPC in your library, you often don’t need to do anything. If you are doing the latter, you just need to make sure that either (a) the two can co-exist happily, or (b) you get the user to terminate anything that might be using the old version.
  • In most cases, you don’t need to restart after installing a KEXT. Instead, consider using kextload(8) in your postinstall script. If you’re replacing an existing KEXT, just use kextunload(8) to unload it first.
  • You don’t need to restart after adding launch daemons or agents, or if you’re using the older startup items. For launch daemons and agents, just use launchctl(1) to load their plists and start them. For startup items, use SystemStarter(8).
  • You don’t need to restart after installing plug-ins. You might need to restart the program that the plug-ins are for, but please check rather than just assuming because some software may be able to cope with plug-ins being installed (and even removed) at runtime.
  • Remember that Mac OS X provides UNIX-like deletion semantics. That is, you can safely delete a file that is currently in use; anything that has the file open will continue to see the original data until the file is closed.

So please, when you’re building Installer packages, don’t unnecessarily force the user to restart his machine. In particular, if you are not sure whether you need to restart, please ask someone on one of Apple’s many mailing lists or ask Developer Technical Support for their advice.

Don’t just assume that you should restart, because that gives a very bad user experience for your customers; remember, if the user reinstalls their machine from scratch, they may have to install many pieces of software, and if every one of those asks to restart their machine, they are rapidly going to become irritated; even if restarting is optional, end users have no way to know if a restart is necessary.