Skip to content

Instantly share code, notes, and snippets.

@ozgrozer
Last active October 17, 2023 13:21
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ozgrozer/aa3d0fe4d8c9ae8b04a3622f2e55fc04 to your computer and use it in GitHub Desktop.
Save ozgrozer/aa3d0fe4d8c9ae8b04a3622f2e55fc04 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

@nurhlmi
Copy link

nurhlmi commented Jul 31, 2021

Works on: MacOS Catalina 10.15.7, XAMPP 8.0.3-0

@F4dhil9ant3ng
Copy link

Works on: MacOS Monterey 12.3.1, XAMPP 8.1.4-1

@renofizaldy
Copy link

Works on: MacOS Sonoma 14.0, XAMPP 8.2.4-0

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