

- MAMP WORDPRESS CONFLICT BETWEEN PORT 80 AND 8888 MAC OS X
- MAMP WORDPRESS CONFLICT BETWEEN PORT 80 AND 8888 CODE
- MAMP WORDPRESS CONFLICT BETWEEN PORT 80 AND 8888 PASSWORD
Tell application "System Events" to set visible of process "MAMP" to falseĪppleScript to open and then hide MAMP.app
MAMP WORDPRESS CONFLICT BETWEEN PORT 80 AND 8888 CODE
This code starts the MAMP control panel and then hides it after a short delay: Set isRunning to every paragraph of (do shell script "ps -acwx -o command | grep -ix " & quoted form of theExpression & " || echo 'false'")ĪppleScript to determine if Apache and MySQL are currently running Set AppleScript's text item delimiters to "" Set theExpression to processName as string Set AppleScript's text item delimiters to "\\|" Set mysqlRunning to my ProcessRunning("mysqld") Set apacheRunning to my ProcessRunning("httpd") # Check if the Apache or MySQL servers are already running This code uses a user-defined function to ensure that MAMP’s Apache and MySQL servers are only started if no other instances of Apache or MySQL are currently running: While this AppleScript will suffice I’ve included some other functionality in the final version. Save this AppleScript as an AppleScript application and add it to the user’s Login Items and MAMP’s Apache and MySQL servers will be up and running when user login is complete.Īccess Control panel for the 'MAMP' keychain item
MAMP WORDPRESS CONFLICT BETWEEN PORT 80 AND 8888 PASSWORD
Substituting the plain text PASSWORD and USERNAME from the original AppleScript for their respective variables: thePassword and theUserName, we can use the following AppleScript:ĭo shell script "/Applications/MAMP/bin/startApache.sh &" password thePassword user name theUserName with administrator privilegesĭo shell script "/Applications/MAMP/bin/startMysql.sh > /dev/null 2>&1"ĪppleScript to start MAMP’s Apache and MySQL servers using the security command in Terminal I prefer using the security command so I’ll include this method in my AppleScript as opposed to Usable Keychain Scripting though the latter will function just as well. Set thePassword to do shell script ("security find-generic-password -wl \"MAMP\"")ĪppleScript to obtain user name and password using the security command in Terminal Set theUserName to do shell script ("security find-generic-password -l \"MAMP\" | grep \"acct\" | cut -c 19-99 | sed 's/\"//g'") # get the user name and password using the security Terminal command The same can be achieved using the security command in Terminal: Repeat with x from 1 to (length of theKeyList)ĪppleScript to obtain user name and password using Usable Keychain Scripting Set theKeyList to every generic item of current keychain whose name is "MAMP" Tell application "Usable Keychain Scripting" # get the user name and password using Usable Keychain Scripting Using Usable Keychain Scripting the following AppleScript will grab the Account Name and Password for the keychain item named MAMP and assign each to a variable:

The two alternatives methods I mentioned earlier for accessing the keychain using AppleScript are Red Sweater’s Usable Keychain Scripting and the security command in Terminal. Enter the Account Name and Password you use to login into your computer and click Add. Open Keychain Access.app in the /Applications/Utilities folder:Īdding a new keychain item in Keychain AccessĮnter the Keychain Item Name. We’ll see two alternative methods later, but first we need to create a new item in our keychain.
MAMP WORDPRESS CONFLICT BETWEEN PORT 80 AND 8888 MAC OS X
Prior to Mac OS X Lion it could be found in /System/Library/ScriptingAdditions/. Unfortunately, as of Mac OS X Lion the Keychain Scripting.app is no longer included. To overcome this security issue a new item can be added to the users keychain and made available to the AppleScript using Keychain Scripting. Saving this AppleScript as an Application and adding it to the Login Items will work but it has one major problem the PASSWORD and USERNAME are stored in plain text.ĭo shell script "/Applications/MAMP/bin/startApache.sh &" password PASSWORD user name USERNAME with administrator privilegesĭo shell script "/Applications/MAMP/bin/startMysql.sh"ĪppleScript to start MAMP’s Apache and MySQL servers with user name and password stored in plain text Not ever having had any success using a launch daemon with MAMP the only alternative appeared to be AppleScript. However, I prefer using the standard ports for Apache: 80 and MySQL: 3306 and doing so requires I enter a password when MAMP starts as port 80 is a privileged or well-known port. Well, they will be if using the default MAMP ports for Apache: 8888 and MySQL: 8889. As I’ve not found a solution to this, the script should no longer be used. Consequently, MAMP is unable to stop any httpd processes started by the script. The script is unable to use this helper tool. : Recent versions of MAMP use a helper tool to start/stop Apache (httpd) if bound to a privileged port below 1024.
