Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Start MAMP at login without password request UNIX
Running MAMP on standard ports (80 for Apache and 3306 for mySQL) makes MAMP ask for a password on each start up. I would like MAMP to start automatically when I log in, without requiring a password. There are a few ways to do this posted around the web, but they all involve hacking MAMP in one way or another. There is an alternative. Create the following AppleScript in AppleScript Editor:
do shell script "/Applications/MAMP/bin/startApache.sh &" password "YOURPASSWORD" user name "YOURUSERNAME" with administrator privileges
do shell script "/Applications/MAMP/bin/startmySQL.sh > /dev/null 2>&1"
Replace YOURPASSWORD and YOURUSERNAME with the proper values, then save it as a run-only application -- to keep anyone from being able to open the script and read your password. Then add that script to your login items. That's it, you're done!

[robg adds: This hint originally appeared in this blog entry; it was submitted here by the blog's owner. I've reproduced it as it was, with one clarifying note and some minor formatting changes to fit our site layout.]
    •    
  • Currently 2.93 / 5
  You rated: 2 / 5 (15 votes cast)
 
[23,138 views]  

Start MAMP at login without password request | 10 comments | Create New Account
Click here to return to the 'Start MAMP at login without password request' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Start MAMP at login without password request
Authored by: devlogic on Apr 21, '10 08:19:48AM

Let me start by saying that I'm not knocking the hint: it's some nice hackery to get an authentication-required service to run on boot, pre-login.

Since both the client and server version of OS X come with Apache (and PHP5) pre-installed, and given that there's a MySQL installer readily available, why choose to run MAMP? Aren't the extra control and security that could be gained (by running it in userspace) negated by starting them with root privileges in order to bind to ports under 1024?



[ Reply to This | # ]
Start MAMP at login without password request
Authored by: Peganthyrus on Apr 21, '10 10:32:09AM

It's all in one bundle and generally tracks new releases of Apache/PHP/MySQL closer than Apple does. Updating that stuff in the OS is a pain in the ass.

And MAMP Pro makes it a lot easier to develop with virtual hosts. Life's a lot easier when you're at the root of 'mywebsite.dev' than when you're at 'localhost://~username/mywebsite'.



[ Reply to This | # ]
Start MAMP at login without password request
Authored by: Superboy on Apr 21, '10 08:20:47AM

Unfortunately just because a script is saved as run-only doesn't mean strings are encrypted. If you show package contents on the app, then go to Contents/Resources/Scripts, you'll find main.scpt. Open this in a text editor to see your password! It'd be better to use keychain scripting, so your password isn't stored as plain text.



[ Reply to This | # ]
Start MAMP at login without password request
Authored by: Andrew J Freyer on Apr 21, '10 09:32:06AM
@Superboy is absolutely correct. This is NOT a safe way to store the user's administrator password.

Try keychain scripting or using terminal command "Security"


set theUserName to do shell script ("security  find-generic-password -gl ****KEYCHAIN ENTRY NAME*** | grep \"acct\" | cut -c 19-99 | sed 's/\"//g'")

set thePassword to do shell script ("security 2>&1 >/dev/null find-generic-password -gl ****KEYCHAIN ENTRY NAME*** | cut -c 11-99 | sed 's/\"//g'")
Or, using Keychain scripting (which is pretty slow):


tell application "Keychain Scripting"
	set myKey to first key of current keychain whose name is "****KEYCHAIN ENTRY NAME***"
	set theUserName to account of myKey
	set thePassword to password of myKey
end tell
---
Easier location-based computing: with Airport Location, app for 10.6. It's an early Beta, so please report bugs!

http://airportlocation.blogspot.com


[ Reply to This | # ]
Start MAMP at login without password request
Authored by: Andrew J Freyer on Apr 21, '10 09:35:47AM

I should note that you'll have to setup, in keychain, a new Generic key with the password that you need to use. Then, it should be named *** KEYCHAIN ENTRY NAME ****

---
Easier location-based computing: with Airport Location, app for 10.6. It's an early Beta, so please report bugs!

http://airportlocation.blogspot.com



[ Reply to This | # ]
Start MAMP at login without password request
Authored by: damex on Jul 31, '10 01:07:25PM

Thanks for the code, Andrew!

I have packaged it up in a nice little app that allows you to start and stop MAMP's Apache and MySQL servers with a single click and doesn't ask for a password each time. It has a nice icon as well :)

You can download it from my blog:
http://www.46palermo.com/blog/run-mamp-without-password-easy-way/

Regards,
Damian



[ Reply to This | # ]
Start MAMP at login without password request
Authored by: Gimmel on Apr 22, '10 01:30:40AM

Iím using MAMP Pro and my Ports are Apache:8888 and MySQL:3306 so I don't need a verification to start MAMP. But my hosts are all set to Port 80. So all the hosts are listening to Port 80 but they are routed internally to Port 8888. It works without problems.
No asking for passwords, no scripts, no tricks.



[ Reply to This | # ]
Start MAMP at login without password request
Authored by: 1000camels on Apr 23, '10 12:00:06PM

i tried this and it didn't work. i'm running Name-based virtual hosting - is this what you are doing?

i have the following:

Listen 8888
NameVirtualHost *:80
<VirtualHost *:80>
...
</VirtualHost>



[ Reply to This | # ]
Start MAMP at login without password request
Authored by: Gimmel on Apr 26, '10 01:48:57AM
As written above, I'm using MAMP Pro. It has a graphical user interface for building your hosts and httpd.conf files. I took a look what it does:
hosts:
127.0.0.1 testserver
httpd.conf:
Listen 80
Listen 8888

<VirtualHost *:80>
	ServerName testserver
	DocumentRoot "/Users/xxx/folder"
	<Directory "/Users/xxx/folder">
		Options Includes FollowSymLinks  
		AllowOverride All
		Order allow,deny
		Allow from all
	</Directory>
</VirtualHost>


[ Reply to This | # ]
Start MAMP at login without password request
Authored by: kainewynd2 on Apr 25, '10 07:29:53AM

It occurs to me that you could use Lingon to make a "Users Daemon" that starts as root at startup without any password embedding. Just make a shell script like so:

#!/bin/bash

# Start MAMP Web Server
/Applications/MAMP/bin/startApache.sh

# Start MAMP MySQL Server
/Applications/MAMP/bin/startmySQL.sh

Put it someplace on your system (I like /usr/local/bin), make it executable (chmod a+x /path/to/file) and make a launchd item with Lingon that uses that script and starts when the computer loads. Everything should start up beautifully.

I haven't tested this...



[ Reply to This | # ]