欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mac Os 下搭建LNMP开发环境

程序员文章站 2022-06-17 15:54:57
...

参考
遇到的坑:

brew tap homebrew/dupes
brew tap homebrew/versions
需要添加第三方库 brew tap homebrew/dupes 的时候,由于有些软件 macOS 已经有了,有一些移动到了 homebrew-core 所以不再需要添加了。详见 Homebrew/homebrew-dupes

These formulae were those that duplicated software provided by macOS.
All formulae were migrated to Homebrew/homebrew-core or deleted.

如果执行这个命令,就会有如下警告:

$ brew tap homebrew/dupes
Warning: homebrew/dupes was deprecated. This tap is now empty as all its formulae were migrated.

Warning: homebrew/versions was deprecated.

同理,还有 homebrew/versions 也不需要添加了。

brew tap homebrew/homebrew-php
出错,需要先执行:

brew untap josegonzalez/php
查看环境PATH:echo $PATH,确认/usr/local/bin, /usr/local/sbin是否存在且排在/usr/sbin之前。如不满足,则需根据你系统所使用的shell,将环境变量添加到~/.bashrc, /.zshrc或/.profile中去:

echo $SHELL

echo 'export PATH="$(brew --prefix php72)/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="$(brew --prefix php72)/sbin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/bin:/usr/local/sbib:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

echo 'export PATH="$(brew --prefix php72)/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="$(brew --prefix php72)/sbin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/bin:/usr/local/sbib:$PATH"' >> ~/.zshrc && . ~/.zshrc
启动PHP-FPM服务

$ brew services start php72
也可通过brew services restart|stop php72命令来重启、停止服务。

配置PHP-FPM随机启动

$ mkdir -p ~/Library/LaunchAgents
$ cp /usr/local/opt/php/homebrew.mxcl.php.plist ~/Library/LaunchAgents/
验证PHP-FPM服务是否启动成功

$ ps aux | grep php-fpm
如存在相关php-fpm进程,则表明启动成功.

sudo visudo
Change this line FROM:
%admin ALL=(ALL) ALL
TO:
%admin ALL=(ALL) NOPASSWD: ALL

安装git server gogs

echo 'export GOROOT=$HOME/local/go' >> ~/.zshrc
echo 'export GOPATH=$HOME/go' >> ~/.zshrc
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> ~/.zshrc && . ~/.zshrc

转载于:https://www.jianshu.com/p/6f491b03793a