I’ve for some time been trying to figure out a way to restart Apache from Alfredapp on OSX. Today I, thanks to @arnejoergensen, discovered osascript which let’s you fire commands with administrator privileges.
That said, you still need to type your password, but instead of doing it in a terminal you get a much more refined dialog to do so.
osascript -e “do shell script "apachectl restart" with administrator privileges”
echo “Apache was restarted”
Remember to tick Growl on advanced tab.
This could probably be done in a much more refined way, but it works :)