Advertisement
Virajsinh

XAMPP automatically start Apache and MySQL on MacOS startup.md

Jul 19th, 2023 (edited)
1,136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.08 KB | None | 0 0
  1. ## XAMPP automatically start Apache and MySQL on MacOS startup
  2.  
  3. ## https://jonathannicol.com/blog/2012/03/12/launching-xampp-at-osx-startup/
  4. ## https://gist.github.com/ozgrozer/aa3d0fe4d8c9ae8b04a3622f2e55fc04
  5.  
  6. 1. Change directory.
  7.  
  8. ```bash
  9. cd /Library/LaunchDaemons
  10. ```
  11.  
  12. 2. Create Apache file for startup.
  13.  
  14. ```bash
  15. sudo vim apachefriends.xampp.apache.start.plist
  16. ```
  17.  
  18. 3. Put these into Apache file.
  19.  
  20. ```xml
  21. <?xml version="1.0" encoding="UTF-8"?>
  22. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  23. <plist version="1.0">
  24.   <dict>
  25.     <key>EnableTransactions</key>
  26.     <true/>
  27.  
  28.     <key>Label</key>
  29.     <string>apachefriends.xampp.apache.start</string>
  30.  
  31.     <key>ProgramArguments</key>
  32.     <array>
  33.       <string>/Applications/XAMPP/xamppfiles/xampp</string>
  34.       <string>startapache</string>
  35.     </array>
  36.  
  37.     <key>RunAtLoad</key>
  38.     <true/>
  39.  
  40.     <key>WorkingDirectory</key>
  41.     <string>/Applications/XAMPP/xamppfiles</string>
  42.  
  43.     <key>KeepAlive</key>
  44.     <false/>
  45.  
  46.     <key>AbandonProcessGroup</key>
  47.     <true/>
  48.   </dict>
  49. </plist>
  50. ```
  51.  
  52. 4. Create MySQL file for startup.
  53.  
  54. ```bash
  55. sudo vim apachefriends.xampp.mysql.start.plist
  56. ```
  57.  
  58. 5. Put these into MySQL file.
  59.  
  60. ```xml
  61. <?xml version="1.0" encoding="UTF-8"?>
  62. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  63. <plist version="1.0">
  64.   <dict>
  65.     <key>EnableTransactions</key>
  66.     <true/>
  67.  
  68.     <key>Label</key>
  69.     <string>apachefriends.xampp.mysql.start</string>
  70.  
  71.     <key>ProgramArguments</key>
  72.     <array>
  73.       <string>/Applications/XAMPP/xamppfiles/xampp</string>
  74.       <string>startmysql</string>
  75.     </array>
  76.  
  77.     <key>RunAtLoad</key>
  78.     <true/>
  79.  
  80.     <key>WorkingDirectory</key>
  81.     <string>/Applications/XAMPP/xamppfiles</string>
  82.  
  83.     <key>KeepAlive</key>
  84.     <false/>
  85.  
  86.     <key>AbandonProcessGroup</key>
  87.     <true/>
  88.   </dict>
  89. </plist>
  90. ```
  91.  
  92. 6. Restart your computer to test it out.
  93.  
  94. ```bash
  95. sudo shutdown -r now
  96. ```
  97.  
  98. ---
  99.  
  100. Works on: MacOS Mojave 10.14.2, XAMPP 7.2.9-0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement