Autostart MAMP Not Working

I’m trying to get MAMP to autostart on OS X Mavericks and I’m following the instructions here (link) but I guess I’m not doing something right for it’s not autostarting after rebooting.

Any suggestions?

Thanks.

Hi,

Could you post your .plist files here? Try the following from a Terminal to see if everything is configured properly:

  1. Stop the servers

  2. Try to start the servers using the plist file

     $ sudo launchctl load -w /Library/LaunchDaemons/com.yourplistfile.plist
    

Note that this configuration requires to install MAMP as administrator user. What port is your current Apache server using?

Here’s the .plist file to start apache:
com.bitnami.apache.service.plist

<?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>ctlscript-mysql</string>
        <key>ProgramArguments</key>
        <array>
                <string>//Applications/mampstack-5.4.24-0/mysql/bin/mysqld_safe</string>
                <string>--defaults-file=/Applications/mampstack-5.4.24-0/mysql/my.cnf</string>
                <string>--port=3306</string>
                <string>--socket=/Applications/mampstack-5.4.24-0/mysql/tmp/mysql.sock</string>
                <string>--datadir=/Applications/mampstack-5.4.24-0/mysql/data</string>
                <string>--log-error=/Applications/mampstack-5.4.24-0/mysql/data/mysqld.log</string>
                <string>--pid-file=/Applications/mampstack-5.4.24-0/mysql/data/${machine_hostname}.pid</string>
       </array>
        <key>RunAtLoad</key>
        <true/>
        <key>UserName</key>
        <string>_mysql</string>
        <key>GroupName</key>
        <string>_mysql</string>
</dict>
</plist>

And here’s the .plist file to start MySQL:
com.bitnami.mysql.service.plist

<?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>ctlscript-mysql</string>
        <key>ProgramArguments</key>
        <array>
                <string>//Applications/mampstack-5.4.24-0/mysql/bin/mysqld_safe</string>
                <string>--defaults-file=/Applications/mampstack-5.4.24-0/mysql/my.cnf</string>
                <string>--port=3306</string>
                <string>--socket=/Applications/mampstack-5.4.24-0/mysql/tmp/mysql.sock</string>
                <string>--datadir=/Applications/mampstack-5.4.24-0/mysql/data</string>
                <string>--log-error=/Applications/mampstack-5.4.24-0/mysql/data/mysqld.log</string>
                <string>--pid-file=/Applications/mampstack-5.4.24-0/mysql/data/${machine_hostname}.pid</string>
       </array>
        <key>RunAtLoad</key>
        <true/>
        <key>UserName</key>
        <string>_mysql</string>
        <key>GroupName</key>
        <string>_mysql</string>
</dict>
</plist>

When I tried the launchctl as you mentioned I got the error message “launchctl: Dubious ownership on file (skipping): /Library/LaunchDaemons/com.bitnami.apache.service.plist” then “nothing found to load”. Looking at the file the permissions are as follows:

Administrator (me): Read/Write
wheel: Read only
everyone: Read only

I enabled the root account following the directions here (link) then installed MAMP as root. The port that Apache server is using is port 80 (SSL Port is 443).

Hi @jhemphill

how did you edit/create the files?. I’ve tried it just right now (through “sudo vim”) and it worked as expected. Also, this problem usually happens when a plist is owned by root and is writable by other another user. Although you wrote the permissions here (and they seem fine), Before trying to fix it, I noticed that although you are creating a file for mysql and for apache, you are using the same code. Maybe when you pasted them here you pasted the same code. But, please, check it too. Could you run this commands?:

sudo chown root /Library/LaunchDaemons/com.bitnami.apache.service.plist
sudo chmod 644 /Library/LaunchDaemons/com.bitnami.apache.service.plist
sudo launchctl load -w /Library/LaunchDaemons/com.bitnami.apache.service.plist

Now, you should be able to access to your apache service.

Did the mysql plist work properly?

Best regards!

@cristian,
D’oh! Here’s the correct .plist file to start apache:
com.bitnami.apache.service.plist

<?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.apache.services</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Applications/mampstack-5.4.24-0/ctlscript.sh</string>
      <string>start</string>   
      <string>apache</string>    
    </array>
    <key>UserName</key>
    <string>root</string>
    <key>RunAtLoad</key>
    <true/>

    <key>OnDemand</key>
    <false/>
  </dict>
</plist>

I used the HTML editor program TextWrangler, and basically copy/paste the script it, and then edited the files as needed.

I’m having the same issue with the mysql plist as well.

I tried the commands you suggested and still getting the error previously mentioned “Dubious ownership…”

Here’s a list of of the files:

-rw-r--r--@  1 644    wheel   577 Feb  1 11:48 com.bitnami.apache.service.plist
-rw-r--r--@  1 admin  wheel  1111 Feb  1 11:20 com.bitnami.mysql.service.plist

Thanks for the help so far!

Hi @jhemphill

I think you mixed the commands, as I see that the owner of one of the files is “644”. Follow this steps, and you will be able to autostart the services:

Stop the daemons from the MAMP Manager, open a terminal, an run this commands:

sudo chown root /Library/LaunchDaemons/com.bitnami.*
sudo chmod 644 /Library/LaunchDaemons/com.bitnami.*

With this commands, you will configure the correct permissions and owner. Run:

ls -l  /Library/LaunchDaemons/com.bitnami.*
  • You have to see exactly this owner (root wheel) and permissions (-rw-r–r--):

    -rw-r–r-- 1 root wheel 581 3 feb 16:45 com.bitnami.apache.service.plist
    -rw-r–r-- 1 root wheel 1112 3 feb 16:38 com.bitnami.mysql.service.plist

Then, you will be able to start Apache and MySQL doing:

sudo launchctl load -w /Library/LaunchDaemons/com.bitnami.mysql.service.plist
sudo launchctl load -w /Library/LaunchDaemons/com.bitnami.apache.service.plist

And they will be able to autostart too.

Best regards!

Sorry I haven’t replied back in a few days, with a local snow storm and catching up to other issues, I was able to apply the correct permissions and have been able to have Apache and MySQL start automatically now.

Thanks to @cristian and @beltran for helping me with this!

1 Like

I’m having a similar issue on Sierra 10.12.4
Apache Starts but MySQL does not.

I can start MySQL from the Terminal using the command /Applications/Mamp/ctlscript.sh start mysql

Any suggestions?

My .plist file.

<?xml version="1.0" encoding="UTF-8"?> Label ctlscript-mysql ProgramArguments /Applications/Mamp/mysql/bin/mysqld_safe --defaults-file=/Applications/Mamp/mysql/my.cnf --port=3306 --socket=/Applications/Mamp/mysql/tmp/mysql.sock --datadir=/Applications/Mamp/mysql/data --log-error=/Applications/Mamp/mysql/data/mysqld.log --pid-file=/Applications/Mamp/mysql/data/${machine_hostname}.pid RunAtLoad UserName _mysql GroupName _mysql

Hi,

Could you provide the .plist file of the Apache service? Could you try changing the Username and GroupName to root in your mysql .plist file to see if that works?

Best regards,

Javier J. Salmerón

<?xml version="1.0" encoding="UTF-8"?> Label com.bitnami.apache.services ProgramArguments /Applications/Mamp/ctlscript.sh start apache UserName root RunAtLoad
<key>OnDemand</key>
<false/>

Hi @b.pfafenzone,

Could you try to check @jsalmeron’s suggestion for the MySQL .plist file? Also, just to confirm, did you follow this guide for setting up the autostart? https://docs.bitnami.com/installer/faq/osx-faq/#how-to-start-the-stack-automatically-on-boot

Thanks!

Hi @b.pfafenzone,

As mentioned in this thread, we have been looking into this issue and have found a plist that works for us. Could you try to apply it?

Before doing anything, please do launchctl unload -w to the plist files you added. After that, create the following .plist files and load them with launchctl load -w:

File: /Library/LaunchDaemons/com.bitnami-mamp.apache.service.plist

<?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-mamp.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>

File: /Library/LaunchDaemons/com.bitnami-mamp.mysql.service.plist

<?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-mamp.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>

NOTE: Don’t forget to replace all INSTALLDIR and USERNAME placeholders.

I hope it works!