Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save erwinagpasa/17a501aa57bb45708da643ca274ccb29 to your computer and use it in GitHub Desktop.
Save erwinagpasa/17a501aa57bb45708da643ca274ccb29 to your computer and use it in GitHub Desktop.
XAMPP automatically start Apache and MySQL on MacOS startup

XAMPP automatically start Apache and MySQL on MacOS startup

  1. Change directory.
cd /Library/LaunchDaemons
  1. Create Apache file for startup.
sudo vim apachefriends.xampp.apache.start.plist
  1. Put these into Apache file.
<?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>EnableTransactions</key>
    <true/>

    <key>Label</key>
    <string>apachefriends.xampp.apache.start</string>

    <key>ProgramArguments</key>
    <array>
      <string>/Applications/XAMPP/xamppfiles/xampp</string>
      <string>startapache</string>
    </array>

    <key>RunAtLoad</key>
    <true/>

    <key>WorkingDirectory</key>
    <string>/Applications/XAMPP/xamppfiles</string>

    <key>KeepAlive</key>
    <false/>

    <key>AbandonProcessGroup</key>
    <true/>
  </dict>
</plist>
  1. Create MySQL file for startup.
sudo vim apachefriends.xampp.mysql.start.plist
  1. Put these into MySQL file.
<?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>EnableTransactions</key>
    <true/>

    <key>Label</key>
    <string>apachefriends.xampp.mysql.start</string>

    <key>ProgramArguments</key>
    <array>
      <string>/Applications/XAMPP/xamppfiles/xampp</string>
      <string>startmysql</string>
    </array>

    <key>RunAtLoad</key>
    <true/>

    <key>WorkingDirectory</key>
    <string>/Applications/XAMPP/xamppfiles</string>

    <key>KeepAlive</key>
    <false/>

    <key>AbandonProcessGroup</key>
    <true/>
  </dict>
</plist>
  1. Restart your computer to test it out.
sudo shutdown -r now

Works on: MacOS Mojave 10.14.2, XAMPP 7.2.9-0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment