1 下载安装最新的xampp


2 安装完成后,使用下面的命令开始运行 XAMPP。在终端下以系统管理员 root 的身份登录
管理员root身份登录
sudo su使用命令启动XAMPP
/Applications/XAMPP/xamppfiles/xampp start启动成功

如果出现类似这种报错
/Applications/XAMPP/xamppfiles//var/proftpd/start.err可以执行下面命令
sudo mkdir /Applications/XAMPP/xamppfiles/var/proftpd/  
touch /Applications/XAMPP/xamppfiles/var/proftpd/start.err  
sudo /Applications/XAMPP/xamppfiles/xampp fix_rights然后在重复上面命令
安装成功输入 http://localhost/dashboard/

其他命令
重启apache:sudo /usr/sbin/apachectl restart
关闭apache:sudo /usr/sbin/apachectl stop
开启apache:sudo /usr/sbin/apachectl start原文:https://www.cnblogs.com/mayufo/p/6170785.html