Skip to content

Instantly share code, notes, and snippets.

@sameeramin
Created April 2, 2024 06:52
Show Gist options
  • Save sameeramin/76fd2bc738b1a47663b2ed5f1b68ef1a to your computer and use it in GitHub Desktop.
Save sameeramin/76fd2bc738b1a47663b2ed5f1b68ef1a to your computer and use it in GitHub Desktop.
A simple function to start, stop and restart MAMP server from terminal
function mamp() {
# Author: Muhammad Sameer
# Gist: https://gist.github.com/sameeramin/76fd2bc738b1a47663b2ed5f1b68ef1a
# License: MIT
# Description: A simple function to start, stop and restart MAMP server from terminal
if [ -z "$1" ]; then
echo "Usage: mamp <start|stop|restart>"
return 1
fi
if [ "$1" = "start" ]; then
/Applications/MAMP/bin/start.sh && osascript -e 'display notification "MAMP started successfully" with title "MAMP"'
elif [ "$1" = "stop" ]; then
/Applications/MAMP/bin/stop.sh && osascript -e 'display notification "MAMP stopped successfully" with title "MAMP"'
elif [ "$1" = "restart" ]; then
/Applications/MAMP/bin/stop.sh && /Applications/MAMP/bin/start.sh && osascript -e 'display notification "MAMP restarted successfully" with title "MAMP"'
else
echo "Usage: mamp <start|stop|restart>"
return 1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment