Mac Startup Items are deprecated in favor of launchd
Mac OS X startup is nothing like other Unix systems. Most significantly, Mac OS X has nothing like the /etc/init.d directory. Instead, it finds its startup items in either /System/Library/StartupItems (for system startup items) or /Library/StartupItems (for locally-installed startup items).
To get compilers and many other development tools, you'll need the Mac OS X Developer tools. If you bought the boxed version of Mac OS X 10.2 (Jaguar), the Developer Tools should be included on a separate CD-ROM. If you bought a new Macintosh that came with Mac OS X preinstalled, the Developer Tools installer will probably be in /Applications/Installers. Failing either of those, or if you'd like to get the latest version of the tools, they are available to Apple Developer Connection (ADC) members.
You can use existing startup items as a template, or check out Mac OS X for Unix Geeks for detailed instructions. At a minimum, you need to:
After you've done these steps, you can start the service with SystemStarter, as in sudo SystemStarter start MySQL.
Directory Structure:
Localizable.strings
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> <plist version="0.9"> <dict> <key>MySQL</key> <string>MySQL</string> </dict> </plist>
MySQL
#!/bin/sh ## # Configure MySQL Server ## . /etc/rc.common StartService () { ConsoleMessage "Starting MySQL Database" /sw/bin/mysqld_safe --user=mysql & } StopService () { ConsoleMessage "Stopping MySQL Database" /sw/share/mysql/mysql.server stop } RestartService () { ConsoleMessage "Restarting MySQL Database" /sw/share/mysql/mysql.server restart } StatusService () { ps auxww | grep mysqld | grep -v grep > /dev/null 2>&1 if [ $? -eq 0 ]; then ConsoleMessage "MySQL is running." else ConsoleMessage "MySQL is not running." fi } RunService "$1"
StartupParameters.plist
{ Description = "MySQL Database Server"; Provides = ("MySQL"); Requires = ("Resolver"); Uses = ("Network Time", "NFS"); OrderPreference = "None"; Messages = { start = "Starting MySQL"; stop = "Stopping MySQL"; }; }
/etc/hostconfig (excerpt)
... MYSQL=-YES- ...