nativeInstaller

Start the stack automatically on boot

NOTE: You will need administrator privileges to perform the steps below.


NOTE: Once you have enabled auto-start using the technique outlined below, you will no longer be able to stop the server using the graphical manager.

Follow the steps below, replacing the APPNAME placeholder in all the information that follow with the application name:

  • Write a properties file (a type of configuration file with a .plist extension) in the /Library/LaunchDaemons folder for each service to be started. Typically, you would create the file /Library/LaunchDaemons/com.bitnami-APPNAME.apache.service.plist to start the Apache Web server, and the file /Library/LaunchDaemons/com.bitnami-APPNAME.mysql.service.plist to start the MySQL database server.

    For example, if using the Bitnami Drupal stack, create the file /Library/LaunchDaemons/com.bitnami-drupal.apache.service.plist to start the Apache Web server, and the file /Library/LaunchDaemons/com.bitnami-drupal.mysql.service.plist to start the MySQL database server.

  • Edit the /Library/LaunchDaemons/com.bitnami-APPNAME.apache.service.plist file and fill it with the following information. Replace the APPNAME placeholder with the application name and the USERNAME placeholder with the name of the user account the stack was installed under, or root if the stack was installed by an administrator.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>Label</key>
            <string>com.bitnami-APPNAME.apache</string>
            <key>ProgramArguments</key>
            <array>
                <string>installdir/apache2/bin/httpd</string>
                <string>-f</string>
                <string>installdir/apache2/conf/httpd.conf</string>
                <string>-DFOREGROUND</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
            <key>UserName</key>
            <string>USERNAME</string>
        </dict>
    </plist>
    
  • Edit the /Library/LaunchDaemons/com.bitnami-APPNAME.mysql.service.plist file and fill it with the following information. Replace the APPNAME placeholder with the application name and the USERNAME placeholder with the name of the user account the stack was installed under, or root if the stack was installed by an administrator.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>Label</key>
            <string>com.bitnami-APPNAME.mysql</string>
            <key>ProgramArguments</key>
            <array>
                <string>installdir/mysql/bin/mysqld_safe</string>
                <string>--defaults-file=installdir/mysql/my.cnf</string>
                <string>--mysqld=mysqld.bin</string>
                <string>--socket=installdir/mysql/tmp/mysql.sock</string>
                <string>--datadir=installdir/mysql/data</string>
                <string>--log-error=installdir/mysql/data/mysqld.log</string>
                <string>--pid-file=installdir/mysql/data/mysqld.pid</string>
                <string>--lower-case-table-names=1</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
            <key>UserName</key>
            <string>USERNAME</string>
        </dict>
    </plist>
    

Reboot your system and the servers should start automatically.

An alternative is to use the launchctl tool to start the services manually, as shown below. Replace the APPNAME and SERVICENAME placeholders with the application name (eg. wordpress) and service name (eg. apache or mysql) respectively.

$ launchctl load -w /Library/LaunchDaemons/com.bitnami-APPNAME.SERVICENAME.service.plist

To uninstall the service:

  • Run the command below:

    $ launchctl unload -w /Library/LaunchDaemons/com.bitnami-APPNAME.SERVICENAME.service.plist
    
  • Delete the properties file:

    $ rm /Library/LaunchDaemons/com.bitnami-APPNAME.SERVICENAME.service.plist