Home
Linux
Golang
MySQL
PHP
Other
Mac 开发环境搭建
创建日期:2020-07-15 23:28:59
更新日期:2023-09-26 11:41:18
栏目:
Other
浏览:2461
[TOC] # Mac 环境安装 ## 安装 HomeBrew 如果你试过:git代理,VPN,删文件等还是没解决,那就用国内镜像 ### 采用国内镜像 `/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"` 安装如下图所示   ## MySQL 5.7.28 MySQL直接去官网下载即可,官网地址: ## Web 代理服务器 ### Apache Mac 自带 Apache,查看版本 `httpd -v` - 配置文件位置:`/etc/apache2/httpd.conf` 可以在配置文件末加一行 `Include /private/etc/apache2/other/*.conf` 引入其他配置文件 - 默认网站根目录:`/Library/WebServer/Documents` - 启动等命令 `apachectl start stop restart ` - 优化 URL,开启 Apache 的 `mod_rewrite` 模块 - 启用多站点 1. 开启 Apache 的 `mod_vhost_alias` 模块 1. 开启 `mod_log_config` 模块 1. 开启 `Include /private/etc/apache2/extra/httpd-vhosts.conf` ``` # 编辑主配置文件: httpd.conf 在 228行为: <Directory /> AllowOverride none Require all denied ## 这一行,拒绝所有链接了 </Directory> 改为如下形式: <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Allow from all </Directory> # 在一下配置文件中,添加你的虚拟站点 /private/etc/apache2/extra/httpd-vhosts.conf ``` ### Nginx 采用 Homebrew 安装 - 使用 Homebrew 安装 Nginx,安装如下所示 ``` dev:Homebrew shuxiaoyuan$ brew install nginx ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openssl%401.1-1.1.1g.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/pcre-8.44.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/nginx-1.19.1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Installing dependencies for nginx: openssl@1.1 and pcre ==> Installing nginx dependency: openssl@1.1 ==> Pouring openssl@1.1-1.1.1g.mojave.bottle.tar.gz ==> Caveats A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in /usr/local/etc/openssl@1.1/certs and run /usr/local/opt/openssl@1.1/bin/c_rehash openssl@1.1 is keg-only, which means it was not symlinked into /usr/local, because macOS provides LibreSSL. If you need to have openssl@1.1 first in your PATH run: echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find openssl@1.1 you may need to set: export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" ==> Summary 🍺 /usr/local/Cellar/openssl@1.1/1.1.1g: 8,059 files, 18MB ==> Installing nginx dependency: pcre ==> Pouring pcre-8.44.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/pcre/8.44: 204 files, 5.5MB ==> Installing nginx ==> Pouring nginx-1.19.1.mojave.bottle.tar.gz ==> Caveats Docroot is: /usr/local/var/www The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo. nginx will load all files in /usr/local/etc/nginx/servers/. To have launchd start nginx now and restart at login: brew services start nginx Or, if you don't want/need a background service you can just run: nginx ==> Summary 🍺 /usr/local/Cellar/nginx/1.19.1: 25 files, 2.1MB ==> Caveats ==> openssl@1.1 A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in /usr/local/etc/openssl@1.1/certs and run /usr/local/opt/openssl@1.1/bin/c_rehash openssl@1.1 is keg-only, which means it was not symlinked into /usr/local, because macOS provides LibreSSL. If you need to have openssl@1.1 first in your PATH run: echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find openssl@1.1 you may need to set: export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include" ==> nginx Docroot is: /usr/local/var/www The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that nginx can run without sudo. nginx will load all files in /usr/local/etc/nginx/servers/. To have launchd start nginx now and restart at login: brew services start nginx Or, if you don't want/need a background service you can just run: nginx ``` - 一些命令,差不多,启动默认是 8080 端口,安装完成后都会告诉你,具体看上面的 ``` # 检查配置文件 nginx -t # 重新加载配置文件 nginx -s reload # 启动,停止,重启 brew services start nginx brew services stop nginx brew services restart nginx # 配置文件位置 /usr/local/etc/nginx/nginx.conf ``` ## PHP 采用 Homebrew 安装 - 添加仓库 ``` brew tap homebrew/core brew tap josegonzalez/php ``` - 查找 PHP `brew search php`  - 安装 PHP 7.3 保留安装信息,备查 ``` dev:php-7.4.7 shuxiaoyuan$ brew install php@7.3 Updating Homebrew... ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/apr-1.7.0.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/apr-util-1.6.1_3.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/argon2-20190702_1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/aspell-0.60.8.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/autoconf-2.69.mojave.bottle.4.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/brotli-1.0.7.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/c-ares-1.16.1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libidn-1.35.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libmetalink-0.1.3.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libssh2-1.9.0_1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/jansson-2.13.1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/jemalloc-5.2.1_1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libev-4.33.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libevent-2.1.12.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/nghttp2-1.41.0.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openldap-2.4.50.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/rtmpdump-2.4%2B20151223_1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/curl-openssl-7.71.1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libtool-2.4.6_2.mojave.bottle.tar.gz ==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/77ca68934e7ed9b9b0b8ce17618d7f08fc5d5a95d7b845622bf57345ffb1c0d6?respon ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/unixodbc-2.3.7.mojave.bottle.1.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/freetds-1.2.3.mojave.bottle.tar.gz ==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/0c3ec566c5f569b214c94d1d1508353cd9d34f8d3122ae0e3dd9e20881f808ab?respon ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libpng-1.6.37.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/freetype-2.10.2.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/gettext-0.20.2_1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libffi-3.3.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/gdbm-1.18.1.mojave.bottle.1.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/readline-8.0.4.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/sqlite-3.32.3.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/xz-5.2.5.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/python%403.8-3.8.3_2.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/glib-2.64.4.mojave.bottle.tar.gz ==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/70e9afe4b735e858e15a5f958b572afb1a3811b8f9f70f83acc817b6b95d5f1b?respon ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/gmp-6.2.0.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/icu4c-67.1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/jpeg-9d.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/krb5-1.18.2.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libpq-12.3.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libsodium-1.0.18_1.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libzip-1.7.2.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/tidy-html5-5.6.0.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libtiff-4.1.0.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/webp-1.1.0.mojave.bottle.tar.gz ######################################################################## 100.0% ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/php%407.3-7.3.20.mojave.bottle.tar.gz ==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/8f1ab87a3e6c1b776792f9e8e5fdd763362d8ae2fb8fdebe2411fc575e3debaa?respon ######################################################################## 100.0% ==> Installing dependencies for php@7.3: apr, apr-util, argon2, aspell, autoconf, brotli, c-ares, libidn, libmetalink, libssh2, jansson, jemalloc, libev, libevent, nghttp2, openldap, rtmpdump, curl-openssl, libtool, unixodbc, freetds, libpng, freetype, gettext, libffi, gdbm, readline, sqlite, xz, python@3.8, glib, gmp, icu4c, jpeg, krb5, libpq, libsodium, libzip, tidy-html5, libtiff and webp ==> Installing php@7.3 dependency: apr ==> Pouring apr-1.7.0.mojave.bottle.tar.gz ==> Caveats apr is keg-only, which means it was not symlinked into /usr/local, because Apple's CLT provides apr. If you need to have apr first in your PATH run: echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile ==> Summary 🍺 /usr/local/Cellar/apr/1.7.0: 59 files, 1.4MB ==> Installing php@7.3 dependency: apr-util ==> Pouring apr-util-1.6.1_3.mojave.bottle.tar.gz ==> Caveats apr-util is keg-only, which means it was not symlinked into /usr/local, because Apple's CLT provides apr (but not apr-util). If you need to have apr-util first in your PATH run: echo 'export PATH="/usr/local/opt/apr-util/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile ==> Summary 🍺 /usr/local/Cellar/apr-util/1.6.1_3: 54 files, 771.1KB ==> Installing php@7.3 dependency: argon2 ==> Pouring argon2-20190702_1.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/argon2/20190702_1: 12 files, 591KB ==> Installing php@7.3 dependency: aspell ==> Pouring aspell-0.60.8.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/aspell/0.60.8: 767 files, 322.4MB ==> Installing php@7.3 dependency: autoconf ==> Pouring autoconf-2.69.mojave.bottle.4.tar.gz ==> Caveats Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/autoconf ==> Summary 🍺 /usr/local/Cellar/autoconf/2.69: 71 files, 3.0MB ==> Installing php@7.3 dependency: brotli ==> Pouring brotli-1.0.7.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/brotli/1.0.7: 25 files, 2.2MB ==> Installing php@7.3 dependency: c-ares ==> Pouring c-ares-1.16.1.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/c-ares/1.16.1: 74 files, 519.4KB ==> Installing php@7.3 dependency: libidn ==> Pouring libidn-1.35.mojave.bottle.tar.gz ==> Caveats Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/libidn ==> Summary 🍺 /usr/local/Cellar/libidn/1.35: 72 files, 1.4MB ==> Installing php@7.3 dependency: libmetalink ==> Pouring libmetalink-0.1.3.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/libmetalink/0.1.3: 31 files, 178.9KB ==> Installing php@7.3 dependency: libssh2 ==> Pouring libssh2-1.9.0_1.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/libssh2/1.9.0_1: 184 files, 942KB ==> Installing php@7.3 dependency: jansson ==> Pouring jansson-2.13.1.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/jansson/2.13.1: 11 files, 163KB ==> Installing php@7.3 dependency: jemalloc ==> Pouring jemalloc-5.2.1_1.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/jemalloc/5.2.1_1: 16 files, 1.9MB ==> Installing php@7.3 dependency: libev ==> Pouring libev-4.33.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/libev/4.33: 12 files, 446.1KB ==> Installing php@7.3 dependency: libevent ==> Pouring libevent-2.1.12.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/libevent/2.1.12: 57 files, 1.8MB ==> Installing php@7.3 dependency: nghttp2 ==> Pouring nghttp2-1.41.0.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/nghttp2/1.41.0: 26 files, 2.7MB ==> Installing php@7.3 dependency: openldap ==> Pouring openldap-2.4.50.mojave.bottle.tar.gz ==> Caveats openldap is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have openldap first in your PATH run: echo 'export PATH="/usr/local/opt/openldap/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile echo 'export PATH="/usr/local/opt/openldap/sbin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find openldap you may need to set: export LDFLAGS="-L/usr/local/opt/openldap/lib" export CPPFLAGS="-I/usr/local/opt/openldap/include" ==> Summary 🍺 /usr/local/Cellar/openldap/2.4.50: 328 files, 6.5MB ==> Installing php@7.3 dependency: rtmpdump ==> Pouring rtmpdump-2.4+20151223_1.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/rtmpdump/2.4+20151223_1: 20 files, 422.1KB ==> Installing php@7.3 dependency: curl-openssl ==> Pouring curl-openssl-7.71.1.mojave.bottle.tar.gz ==> Caveats curl-openssl is keg-only, which means it was not symlinked into /usr/local, because macOS provides curl. If you need to have curl-openssl first in your PATH run: echo 'export PATH="/usr/local/opt/curl-openssl/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find curl-openssl you may need to set: export LDFLAGS="-L/usr/local/opt/curl-openssl/lib" export CPPFLAGS="-I/usr/local/opt/curl-openssl/include" ==> Summary 🍺 /usr/local/Cellar/curl-openssl/7.71.1: 464 files, 3.5MB ==> Installing php@7.3 dependency: libtool ==> Pouring libtool-2.4.6_2.mojave.bottle.tar.gz ==> Caveats In order to prevent conflicts with Apple's own libtool we have prepended a "g" so, you have instead: glibtool and glibtoolize. ==> Summary 🍺 /usr/local/Cellar/libtool/2.4.6_2: 71 files, 3.7MB ==> Installing php@7.3 dependency: unixodbc ==> Pouring unixodbc-2.3.7.mojave.bottle.1.tar.gz 🍺 /usr/local/Cellar/unixodbc/2.3.7: 46 files, 1.8MB ==> Installing php@7.3 dependency: freetds ==> Pouring freetds-1.2.3.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/freetds/1.2.3: 2,072 files, 14.8MB ==> Installing php@7.3 dependency: libpng ==> Pouring libpng-1.6.37.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/libpng/1.6.37: 27 files, 1.2MB ==> Installing php@7.3 dependency: freetype ==> Pouring freetype-2.10.2.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/freetype/2.10.2: 61 files, 2.3MB ==> Installing php@7.3 dependency: gettext ==> Pouring gettext-0.20.2_1.mojave.bottle.tar.gz ==> Caveats Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/gettext ==> Summary 🍺 /usr/local/Cellar/gettext/0.20.2_1: 1,929 files, 18.7MB ==> Installing php@7.3 dependency: libffi ==> Pouring libffi-3.3.mojave.bottle.tar.gz ==> Caveats libffi is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. For compilers to find libffi you may need to set: export LDFLAGS="-L/usr/local/opt/libffi/lib" export CPPFLAGS="-I/usr/local/opt/libffi/include" ==> Summary 🍺 /usr/local/Cellar/libffi/3.3: 16 files, 484.8KB ==> Installing php@7.3 dependency: gdbm ==> Pouring gdbm-1.18.1.mojave.bottle.1.tar.gz 🍺 /usr/local/Cellar/gdbm/1.18.1: 20 files, 586.8KB ==> Installing php@7.3 dependency: readline ==> Pouring readline-8.0.4.mojave.bottle.tar.gz ==> Caveats readline is keg-only, which means it was not symlinked into /usr/local, because macOS provides BSD libedit. For compilers to find readline you may need to set: export LDFLAGS="-L/usr/local/opt/readline/lib" export CPPFLAGS="-I/usr/local/opt/readline/include" ==> Summary 🍺 /usr/local/Cellar/readline/8.0.4: 48 files, 1.5MB ==> Installing php@7.3 dependency: sqlite ==> Pouring sqlite-3.32.3.mojave.bottle.tar.gz ==> Caveats sqlite is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have sqlite first in your PATH run: echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find sqlite you may need to set: export LDFLAGS="-L/usr/local/opt/sqlite/lib" export CPPFLAGS="-I/usr/local/opt/sqlite/include" ==> Summary 🍺 /usr/local/Cellar/sqlite/3.32.3: 11 files, 4MB ==> Installing php@7.3 dependency: xz ==> Pouring xz-5.2.5.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/xz/5.2.5: 92 files, 1.1MB ==> Installing php@7.3 dependency: python@3.8 ==> Pouring python@3.8-3.8.3_2.mojave.bottle.tar.gz Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink bin/2to3-3.8 Target /usr/local/bin/2to3-3.8 already exists. You may want to remove it: rm '/usr/local/bin/2to3-3.8' To force the link and overwrite all conflicting files: brew link --overwrite python@3.8 To list all files that would be deleted: brew link --overwrite --dry-run python@3.8 Possible conflicting files are: /usr/local/bin/2to3-3.8 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/2to3-3.8 /usr/local/bin/idle3 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/idle3 /usr/local/bin/idle3.8 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/idle3.8 /usr/local/bin/pydoc3 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/pydoc3 /usr/local/bin/pydoc3.8 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/pydoc3.8 /usr/local/bin/python3 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 /usr/local/bin/python3-config -> /Library/Frameworks/Python.framework/Versions/3.8/bin/python3-config /usr/local/bin/python3.8 -> /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 /usr/local/bin/python3.8-config -> /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8-config Warning: These files were overwritten during `brew link` step: /usr/local/bin/2to3 They have been backed up in /Users/shuxiaoyuan/Library/Caches/Homebrew/Backup ==> /usr/local/Cellar/python@3.8/3.8.3_2/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/lo ==> /usr/local/Cellar/python@3.8/3.8.3_2/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/lo ==> /usr/local/Cellar/python@3.8/3.8.3_2/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/lo ==> Caveats Python has been installed as /usr/local/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to `python3`, `python3-config`, `pip3` etc., respectively, have been installed into /usr/local/opt/python@3.8/libexec/bin You can install Python packages with pip3 install <package> They will install into the site-package directory /usr/local/lib/python3.8/site-packages See: https://docs.brew.sh/Homebrew-and-Python ==> Summary 🍺 /usr/local/Cellar/python@3.8/3.8.3_2: 4,125 files, 62.8MB ==> Installing php@7.3 dependency: glib ==> Pouring glib-2.64.4.mojave.bottle.tar.gz ==> Caveats Bash completion has been installed to: /usr/local/etc/bash_completion.d ==> Summary 🍺 /usr/local/Cellar/glib/2.64.4: 436 files, 15.7MB ==> Installing php@7.3 dependency: gmp ==> Pouring gmp-6.2.0.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/gmp/6.2.0: 20 files, 3.2MB ==> Installing php@7.3 dependency: icu4c ==> Pouring icu4c-67.1.mojave.bottle.tar.gz ==> Caveats icu4c is keg-only, which means it was not symlinked into /usr/local, because macOS provides libicucore.dylib (but nothing else). If you need to have icu4c first in your PATH run: echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find icu4c you may need to set: export LDFLAGS="-L/usr/local/opt/icu4c/lib" export CPPFLAGS="-I/usr/local/opt/icu4c/include" ==> Summary 🍺 /usr/local/Cellar/icu4c/67.1: 258 files, 71MB ==> Installing php@7.3 dependency: jpeg ==> Pouring jpeg-9d.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/jpeg/9d: 21 files, 751KB ==> Installing php@7.3 dependency: krb5 ==> Pouring krb5-1.18.2.mojave.bottle.tar.gz ==> Caveats krb5 is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have krb5 first in your PATH run: echo 'export PATH="/usr/local/opt/krb5/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile echo 'export PATH="/usr/local/opt/krb5/sbin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find krb5 you may need to set: export LDFLAGS="-L/usr/local/opt/krb5/lib" export CPPFLAGS="-I/usr/local/opt/krb5/include" ==> Summary 🍺 /usr/local/Cellar/krb5/1.18.2: 162 files, 3.8MB ==> Installing php@7.3 dependency: libpq ==> Pouring libpq-12.3.mojave.bottle.tar.gz ==> Caveats libpq is keg-only, which means it was not symlinked into /usr/local, because conflicts with postgres formula. If you need to have libpq first in your PATH run: echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find libpq you may need to set: export LDFLAGS="-L/usr/local/opt/libpq/lib" export CPPFLAGS="-I/usr/local/opt/libpq/include" ==> Summary 🍺 /usr/local/Cellar/libpq/12.3: 2,241 files, 23.7MB ==> Installing php@7.3 dependency: libsodium ==> Pouring libsodium-1.0.18_1.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/libsodium/1.0.18_1: 73 files, 1008.4KB ==> Installing php@7.3 dependency: libzip ==> Pouring libzip-1.7.2.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/libzip/1.7.2: 142 files, 609.0KB ==> Installing php@7.3 dependency: tidy-html5 ==> Pouring tidy-html5-5.6.0.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/tidy-html5/5.6.0: 14 files, 2.6MB ==> Installing php@7.3 dependency: libtiff ==> Pouring libtiff-4.1.0.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/libtiff/4.1.0: 247 files, 3.6MB ==> Installing php@7.3 dependency: webp ==> Pouring webp-1.1.0.mojave.bottle.tar.gz 🍺 /usr/local/Cellar/webp/1.1.0: 39 files, 2.1MB ==> Installing php@7.3 ==> Pouring php@7.3-7.3.20.mojave.bottle.tar.gz ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set php_ini /usr/local/etc/php/7.3/php.ini system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set php_dir /usr/local/share/pear@7.3 system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set doc_dir /usr/local/share/pear@7.3/doc system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set ext_dir /usr/local/lib/php/pecl/20180731 system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set bin_dir /usr/local/opt/php@7.3/bin system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set data_dir /usr/local/share/pear@7.3/data system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set cfg_dir /usr/local/share/pear@7.3/cfg system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set www_dir /usr/local/share/pear@7.3/htdocs system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set man_dir /usr/local/share/man system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set test_dir /usr/local/share/pear@7.3/test system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear config-set php_bin /usr/local/opt/php@7.3/bin/php system ==> /usr/local/Cellar/php@7.3/7.3.20/bin/pear update-channels ==> Caveats To enable PHP in Apache add the following to httpd.conf and restart Apache: LoadModule php7_module /usr/local/opt/php@7.3/lib/httpd/modules/libphp7.so <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> Finally, check DirectoryIndex includes index.php DirectoryIndex index.php index.html The php.ini and php-fpm.ini file can be found in: /usr/local/etc/php/7.3/ php@7.3 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have php@7.3 first in your PATH run: echo 'export PATH="/usr/local/opt/php@7.3/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile echo 'export PATH="/usr/local/opt/php@7.3/sbin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find php@7.3 you may need to set: export LDFLAGS="-L/usr/local/opt/php@7.3/lib" export CPPFLAGS="-I/usr/local/opt/php@7.3/include" To have launchd start php@7.3 now and restart at login: brew services start php@7.3 Or, if you don't want/need a background service you can just run: php-fpm ==> Summary 🍺 /usr/local/Cellar/php@7.3/7.3.20: 521 files, 77MB ==> Caveats ==> apr apr is keg-only, which means it was not symlinked into /usr/local, because Apple's CLT provides apr. If you need to have apr first in your PATH run: echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile ==> apr-util apr-util is keg-only, which means it was not symlinked into /usr/local, because Apple's CLT provides apr (but not apr-util). If you need to have apr-util first in your PATH run: echo 'export PATH="/usr/local/opt/apr-util/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile ==> autoconf Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/autoconf ==> libidn Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/libidn ==> openldap openldap is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have openldap first in your PATH run: echo 'export PATH="/usr/local/opt/openldap/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile echo 'export PATH="/usr/local/opt/openldap/sbin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find openldap you may need to set: export LDFLAGS="-L/usr/local/opt/openldap/lib" export CPPFLAGS="-I/usr/local/opt/openldap/include" ==> curl-openssl curl-openssl is keg-only, which means it was not symlinked into /usr/local, because macOS provides curl. If you need to have curl-openssl first in your PATH run: echo 'export PATH="/usr/local/opt/curl-openssl/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find curl-openssl you may need to set: export LDFLAGS="-L/usr/local/opt/curl-openssl/lib" export CPPFLAGS="-I/usr/local/opt/curl-openssl/include" ==> libtool In order to prevent conflicts with Apple's own libtool we have prepended a "g" so, you have instead: glibtool and glibtoolize. ==> gettext Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/gettext ==> libffi libffi is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. For compilers to find libffi you may need to set: export LDFLAGS="-L/usr/local/opt/libffi/lib" export CPPFLAGS="-I/usr/local/opt/libffi/include" ==> readline readline is keg-only, which means it was not symlinked into /usr/local, because macOS provides BSD libedit. For compilers to find readline you may need to set: export LDFLAGS="-L/usr/local/opt/readline/lib" export CPPFLAGS="-I/usr/local/opt/readline/include" ==> sqlite sqlite is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have sqlite first in your PATH run: echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find sqlite you may need to set: export LDFLAGS="-L/usr/local/opt/sqlite/lib" export CPPFLAGS="-I/usr/local/opt/sqlite/include" ==> python@3.8 Python has been installed as /usr/local/bin/python3 Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to `python3`, `python3-config`, `pip3` etc., respectively, have been installed into /usr/local/opt/python@3.8/libexec/bin You can install Python packages with pip3 install <package> They will install into the site-package directory /usr/local/lib/python3.8/site-packages See: https://docs.brew.sh/Homebrew-and-Python ==> glib Bash completion has been installed to: /usr/local/etc/bash_completion.d ==> icu4c icu4c is keg-only, which means it was not symlinked into /usr/local, because macOS provides libicucore.dylib (but nothing else). If you need to have icu4c first in your PATH run: echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find icu4c you may need to set: export LDFLAGS="-L/usr/local/opt/icu4c/lib" export CPPFLAGS="-I/usr/local/opt/icu4c/include" ==> krb5 krb5 is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble. If you need to have krb5 first in your PATH run: echo 'export PATH="/usr/local/opt/krb5/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile echo 'export PATH="/usr/local/opt/krb5/sbin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find krb5 you may need to set: export LDFLAGS="-L/usr/local/opt/krb5/lib" export CPPFLAGS="-I/usr/local/opt/krb5/include" ==> libpq libpq is keg-only, which means it was not symlinked into /usr/local, because conflicts with postgres formula. If you need to have libpq first in your PATH run: echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find libpq you may need to set: export LDFLAGS="-L/usr/local/opt/libpq/lib" export CPPFLAGS="-I/usr/local/opt/libpq/include" ==> php@7.3 To enable PHP in Apache add the following to httpd.conf and restart Apache: LoadModule php7_module /usr/local/opt/php@7.3/lib/httpd/modules/libphp7.so <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> Finally, check DirectoryIndex includes index.php DirectoryIndex index.php index.html The php.ini and php-fpm.ini file can be found in: /usr/local/etc/php/7.3/ php@7.3 is keg-only, which means it was not symlinked into /usr/local, because this is an alternate version of another formula. If you need to have php@7.3 first in your PATH run: echo 'export PATH="/usr/local/opt/php@7.3/bin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile echo 'export PATH="/usr/local/opt/php@7.3/sbin:$PATH"' >> /Users/shuxiaoyuan/.bash_profile For compilers to find php@7.3 you may need to set: export LDFLAGS="-L/usr/local/opt/php@7.3/lib" export CPPFLAGS="-I/usr/local/opt/php@7.3/include" To have launchd start php@7.3 now and restart at login: brew services start php@7.3 Or, if you don't want/need a background service you can just run: php-fpm ```  ``` # 加入 PATH 环境变量中 sudo vim ~/.bash_profile export PATH="$(brew --prefix php@7.2)/bin:$PATH" source ~/.bash_profile ``` - 启动,在安装完成后会有提示,最后几行 `brew services start php@7.3` - 查看版本 `php -v` ## Redis 第一:去官网下载对应版本安装包 解压:tar zxvf redis-redis-5.0.7.tar.gz 移动到: mv redis-redis-5.0.7 /usr/local/ 切换到:cd /usr/local/redis-5.0.7/ 编译测试 sudo make test 编译安装 sudo make install 出现以下表示安装成功了   运行服务:redis-server  开启另外一个窗口进行连接:redis-cli  配置等:后台运行,守护进程,密码设置等等 如果不安装守护进程的话,Redis就必须一直在前台运行,如果关掉了窗口就导致Redis服务停掉了。这样肯定是不行的,所以接下来必须要安装守护进程 配置:在Redis目录下创建 bin、etc、db三个目录 将Redis/src目录下的几个文件(mkreleasehdr.sh,redis-benchmark, redis-check-rdb, redis-cli, redis-server)拷贝到bin目录下 cd /usr/local/redis-5.0.7/bin cp ../src/redis-benchmark . 。。。。。。自己复制。。。。。。 将Redis.conf 拷贝到 etc目录下,修改配置文件 ``` vim /usr/local/redis-5.0.7/etc/redis.conf # 修改为守护模式 daemonize yes # 设置进程锁文件 pidfile /usr/local/redis-5.0.7/redis.pid # 端口 port 6379 # 设置密码 requirepass Shu.xiaoyuan@163.com # 客户端超时时间 timeout 300 # 日志级别 loglevel debug # 日志文件位置 logfile /usr/local/redis-5.0.7/log-redis.log # 设置数据库的数量,默认数据库为0,可以使用SELECT <dbid>命令在连接上指定数据库id databases 16 ##指定在多长时间内,有多少次更新操作,就将数据同步到数据文件,可以多个条件配合 #save <seconds> <changes> #Redis默认配置文件中提供了三个条件: save 900 1 save 300 10 save 60 10000 #指定存储至本地数据库时是否压缩数据,默认为yes,Redis采用LZF压缩,如果为了节省CPU时间, #可以关闭该#选项,但会导致数据库文件变的巨大 rdbcompression yes #指定本地数据库文件名 dbfilename dump.rdb #指定本地数据库路径 dir /usr/local/redis-5.0.7/db/ #指定是否在每次更新操作后进行日志记录,Redis在默认情况下是异步的把数据写入磁盘,如果不开启,可能 #会在断电时导致一段时间内的数据丢失。因为 redis本身同步数据文件是按上面save条件来同步的,所以有 #的数据会在一段时间内只存在于内存中 appendonly no #指定更新日志条件,共有3个可选值: #no:表示等操作系统进行数据缓存同步到磁盘(快) #always:表示每次更新操作后手动调用fsync()将数据写到磁盘(慢,安全) #everysec:表示每秒同步一次(折衷,默认值) appendfsync everysec ``` 带配置文件启动Redis服务 redis-server etc/redis.conf 查询当前Redis的进程 ps aux | grep redis 正确的关闭Redis:给Redis发送shutdown命令 redis-cli shutdown,如果无效,就进去Redis的安装目录 查看日志:tail -f log-redis.log
内容版权声明:本文为舒孝元原创文章,转载无需和我联系,但请注明来自
舒孝元博客:https://www.shuxiaoyuan.com/info/85
联系邮箱:sxy@shuxiaoyuan.com