1 安裝前準備
1.1 添加Homebrew官方軟體源
brew tap homebrew/versions
brew tap homebrew/php
1.2 更新brew
brew update
2 安裝mysql
2.1 安裝MySQL
brew install mysql
成功安裝結果
==> Caveats
==> protobuf Emacs Lisp files have been installed to: /usr/local/share/emacs/site-lisp/protobuf
==> mysql We’ve installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by
default
To connect run:
mysql -uroot
To have launchd start mysql now and restart at login: brew services
start mysql Or, if you don’t want/need a background service you can
just run: mysql.server start
2.2 設定開機啟動
brew方式設定開機啟動
brew services start mysql
手動設定開機啟動
cp /usr/local/Cellar/mysql/5.7.12/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
brew設定開機啟動MySQL完成後的提示資訊
If you need to have this software first in your PATH run: echo ‘export
PATH="/usr/local/opt/sphinx-doc/bin:$PATH"’ >> ~/.zshrc
/usr/local/Cellar/mysql/5.7.20/bin/mysqld --initialize-insecure
–user=king --basedir=/usr/local/Cellar/mysql/5.7.20 --datadir=/usr/local/var/mysql --tmpdir=/tmp
We’ve installed your MySQL database without a root password. To secure
it run: mysql_secure_installation
MySQL is configured to only allow connections from localhost by
default
A “/etc/my.cnf” from another install may interfere with a
Homebrew-built server starting up correctly.
To have launchd start mysql now and restart at login: brew services
start mysql
Or, if you don’t want/need a background service you can just run:
mysql.server start
2.3 MySQL常用指令
關閉并取消MySQL的開機啟動服務
brew services stop mysql
登入&退出MySQL
mysql -uroot -p
quit
啟動/停止/重新開機
sudo mysql.server start/stop/restart
2.4 MySQL安全配置
注意:
需先運作mysql 。 否則會報錯:Error: Can’t connect to local MySQL server
through socket ‘/tmp/mysql.sock’ (2)
提示說找不到mysql.sock,原因是mysql程序還沒啟動。
修改密碼安全政策,并設定密碼為123456
登入 MySQL
mysql -uroot
設定密碼強度檢查等級, 0:隻檢查長度
設定密碼最小長度 LOW
檢視密碼政策
設定密碼:123456
mysql_secure_installation
2.5 配置檔案介紹
查找mysql服務配置檔案的位置
which mysqld
/usr/local/bin/mysqld
/usr/local/bin/mysqld --verbose --help | grep -A 1 'Default options'
Mac筆記本執行成功結果如圖:

3 安裝PHP
3.1 brew 安裝php56
#檢視php5.6安裝選項
brew options php56
#搜尋PHP56安裝包
brew search php56
#安裝php56
brew install homebrew/php/php56
注意: php56中預設已安裝 php-fpm, nginx, mysql擴充
成功安裝結果
php56啟動以及安裝包垃圾清理
補充說明:
配置檔案位置: /usr/local/etc/php/5.6/php-fpm.conf
# 殺死程序
sudo pkill php-fpm
# 重新開機程序
sudo /usr/local/opt/php56/sbin/php-fpm --fpm-config
# 解除安裝
brew uninstall php56
# 清除緩存以及老舊版本檔案
brew cleanup -s
3.2 設定開機啟動
brew方式設定開機啟動
# To have launchd start homebrew/php/php56 now and restart at login:
brew services start homebrew/php/php56
手動方式設定開機啟動
cp /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
3.3 替換Mac自帶的PHP和php-fpm
補充說明:
添加系統環境變量PATH來替代Mac自帶PHP版本,即優先運作brew安裝的PHP版本。
實作方式:
添加環境變量
注意我們
本人筆記本用的zsh,由于Mac自帶了php和php-fpm,是以需要
具體實作步驟:
#檢視目前用的shell 并修改對應的配置檔案
echo $SHELL
/usr/local/bin/zsh # 本人筆記本用的zsh
#修改zash配置檔案~/.zshrc
#for php
echo 'export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"' >> ~/.zshrc
#for php-fpm
echo 'export PATH="$(brew --prefix homebrew/php/php56)/sbin:$PATH"' >> ~/.zshrc
#for other brew install soft
echo 'export PATH="/usr/local/bin:/usr/local/sbin:$PATH"' >> ~/.zshrc
#更新并使配置生效
source ~/.zshrc
#在~/.zshrc 添加效果如下:
export PATH=/usr/local/opt/php56/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
補充說明:
通過shell配置檔案設定一些環境變量,例:
~/.bashrc:
該檔案包含專用于你的bash shell的bash資訊,當登入時以及每次打開新的shell時,該檔案被讀取.
~/.zshrc:
該檔案包含專用于你的zsh shell的bash資訊,當登入時以及每次打開新的shell時,該檔案被讀取.
3.4 安裝PHP擴充
補充說明:
brew會自動安裝預設的PHP擴充依賴包;
brew方式下直接安裝php擴充,而不用每次重新編譯php,安裝步驟如下:
3.4.1 bottle方式安裝
補充說明:
預設情況下會采用 bottle 方式安裝,bottle 方式就是安裝已編譯好的二進制包。
# 查找擴充
brew search php56
# 安裝擴充指令
brew install homebrew/php/php56-crypto homebrew/php/php56-igbinary homebrew/php/php56-memcache homebrew/php/php56-memcached homebrew/php/php56-mongo homebrew/php/php56-mongodb homebrew/php/php56-pthreads homebrew/php/php56-redis homebrew/php/php56-yaf homebrew/php/php56-mcrypt homebrew/php/php56-swoole homebrew/php/php56-xdebug homebrew/php/php56-opcache
成功安裝結果
3.4.1 源碼方式安裝
brew reinstall homebrew/php/php56-crypto --build-from-source
brew install homebrew/php/php56-xdebug --build-from-source
3.5 PHP常用指令
php –v 即可檢視目前php的版本
php -m 會顯示目前php加載的有效子產品
php -i 輸出無html格式的phpinfo
php -i |grep mongo 檢視你的擴充是否安裝成功
php -ini 輸出目前php加載ini配置檔案的數量,路徑資訊。
php –a 指令打開互動模式,輸入一行代碼,php會實時輸出結果。
php -l hello.php 指令行下檢測php檔案的文法錯誤
php -s hello.php 将php代碼高亮原樣輸出
php -rf function 列印出該函數的文法簡介
php -re function 檢視擴充
php-fpm -v 檢視php-fpm版本
php --ini 檢視所有配置檔案位置
3.6 php7.0 安裝
補充說明:
選擇安裝PHP70,是因為PHP71暫時沒有memcache 擴充;
# 檢視php70安裝選項
brew options php70
# 安裝指令
brew install php70
補充說明:
PHP70和PHP56安裝差不多,但有一個地方主要注意:
- please ‘brew unlink php56’ before continuing => 提示在安裝PHP70之前需要去除之前php56的連結,這樣才可以安裝PHP70
#PHP7.0 擴充安裝
brew install homebrew/php/php70-igbinary homebrew/php/php70-memcache homebrew/php/php70-memcached homebrew/php/php70-mongodb homebrew/php/php70-pthreads homebrew/php/php70-redis homebrew/php/php70-yaf homebrew/php/php70-mcrypt homebrew/php/php70-swoole homebrew/php/php70-xdebug homebrew/php/php70-opcache homebrew/php/php70-lua homebrew/php/php70-gmagick
3.7 PHP多版本控制
3.7.1 方式一:php-version實作版本控制
# 安裝php-version
brew install php-version
PHP版本切換執行個體
3.7.2 方式二: brew link|unlink
通過brew安裝的php可以通過brew link和brew unlink來切換不同版本。
3.7.3 方式三:配置環境變量
補充說明:
隻生效一次
# 操作指令
source $(brew --prefix php-version)/php-version.sh && php-version 5
要想長期生效需要 把這代碼放到~/.bashrc 或者 ~/.zshrc
# 檢視目前PHP版本
php-version
3.7.4 其它方式
http://www.piaoyi.org/php/Mac-brew-php.html
注意:安裝多個PHP版本的時候, 要注意更改配置目錄,其實本質上還是啟動程式優先級問題.比如設定php56 在php70之前, 則用到的就是php56
5 Nginx 安裝
安裝nginx
# 搜尋
brew search nginx
# 安裝
brew install nginx
成功安裝結果
Updating Homebrew…
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.19.1.catalina.bottle.tar.gz
-=O=- # # # # curl: (35) LibreSSL SSL_connect: SSL_ERROR_ZERO_RETURN in connection to d29vzk4ow07wi7.cloudfront.net:443 Error: Failed to
download resource “nginx” Download failed:
https://homebrew.bintray.com/bottles/nginx-1.19.1.catalina.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://nginx.org/download/nginx-1.19.1.tar.gz
######################################################################## 100.0%
==> tar -cJf /usr/local/Cellar/nginx/1.19.1/share/nginx/src/src.tar.xz --options compress
==> ./configure --prefix=/usr/local/Cellar/nginx/1.19.1 --sbin-path=/usr/local/Cellar/ngi
==> make install
==> 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: 10 files, 2MB, built in 32 seconds
補充說明:
配置檔案位置: /usr/local/etc/nginx/nginx.conf
nginx常用指令
# 啟動
nginx
# 重載/~/停止/~
nginx -s reload|reopen|stop|quit
# 校驗配置檔案是否正确
nginx -t
#檢視安裝Nginx時的編譯選項(pid位置, Log日志 配置檔案 安裝目錄 安裝子產品等)
nginx -V
設定開機啟動
cp /usr/local/Cellar/nginx/1.10.0/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
設定nginx監聽80端口
補充說明:
nginx安裝後預設監聽8080端口,可以訪 http://localhost:8080檢視狀态。
設定root權限,監聽80端口
sudo chown root:wheel /usr/local/Cellar/nginx/1.6.2/bin/nginx
sudo chmod u+s /usr/local/Cellar/nginx/1.6.2/bin/nginx
6 brew 方式 安裝 Redis
安裝
brew install redis
成功安裝結果
To have launchd start redis now and restart at login: brew services
start redis #同時會把服務加入開機啟動項 Or, if you don’t want/need a background
service you can just run: redis-server /usr/local/etc/redis.conf
手動方式設定開機啟動
cp /usr/local/Cellar/redis/4.0.2/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
手動方式設定停止開機啟動 launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
redis常用指令
# 指定配置檔案啟動redis server
redis-server /usr/local/etc/redis.conf
#進入指令行模式
redis-cli
# 停止redis server服務
redis-cli shutdown
# 測試redis server是否啟動
redis-cli ping
#設定開機啟動
brew services start/stop/restart redis
補充說明:
redis 配置檔案的位置:/usr/local/etc/redis.conf
配置背景程序啟動
vim /usr/local/etc/redis.conf
修改 daemonize no 為 daemonize yes 預設啟動就背景運作
redis 設定密碼
vim /usr/local/etc/redis.conf
# 修改密碼
requirepass foobared => requirepass pwdcode
重新開機redis
# 先登入redis,關閉服務
shutdown
# 啟動服務
/usr/local/opt/redis/bin/redis-server /usr/local/etc/redis.conf
登入redis
# 登入redis,發現可以登上,但是執行具體指令是提示操作不允許
redis-cli -h 127.0.0.1 -p 6379
# 嘗試用密碼登入并執行具體的指令看到可以成功執行
redis-cli -h 127.0.0.1 -p 6379 -a pwdcode
7 brew 方式 安裝 Memcache
#安裝指令
brew install memcached
成功安裝結果
#To have launchd start memcached now and restart at login: brew services start memcached
#Or, if you don’t want/need a background service you can just run: /usr/local/opt/memcached/bin/memcached
手動設定開機啟動
cp /usr/local/Cellar/memcached/1.5.2/homebrew.mxcl.memcached.plist ~/Library/LaunchAgents
launchctl load/unload ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
連接配接memcache
telnet 127.0.0.1 11211
8 brew 方式 安裝MongoDB
#安裝指令
brew install mongodb
#常用指令
brew services start/stop/restart mongodb
#指定配置檔案啟動mongodb服務
sudo mongod
sudo mongod -f /usr/local/etc/mongod.conf
#啟動用戶端
mongo
#設定開機自啟動
brew services stop/restart mongodb
brew 安裝其他項目支援
brew install composer node
常見問題
問題一:啟動mongodb報錯
2020-07-12T19:09:45.434+0800 I STORAGE [initandlisten] exception in
initAndListen: NonExistentPath: Data directory /data/db not found.,
terminating
解決辦法:
指定配置檔案啟動;
啟動指令:
sudo mongod -f /usr/local/etc/mongod.conf
UPDATE
brew PHP7.4.8 安裝過程
(base) ➜ ~ brew install php Updating Homebrew…
==> Auto-updated Homebrew! Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae ckan exploitdb
==> Updated Casks airy panoply sidequest baidunetdisk pocket-casts toggl
beersmith pokemon-reborn uu-booster
drawio private-internet-access webcatalog
fontlab pyfa wormhole
geotag-photos-pro razorsql itubedownloader
screaming-frog-seo-spider
==> Downloading https://homebrew.bintray.com/bottles/apr-1.7.0.catalina.bottle.t
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/277c42fcf2f5ca298a142
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/apr-util-1.6.1_3.catalina.b
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/425955a21c3fec8e78f36
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/argon2-20190702_1.catalina.
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/f8e550c8597728bb9edc5
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/aspell-0.60.8.catalina.bott
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/f34a5b53fa80f6f0ea3ce
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.catalina.bott
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/ca510b350e941fb939552
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/brotli-1.0.7.catalina.bottl
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/81be7d1d110787a534cd5
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/c-ares-1.16.1.catalina.bott
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libidn-1.35.catalina.bottle
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/a720f31e3d82a3e537ae2
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libmetalink-0.1.3.catalina.
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/jansson-2.13.1.catalina.bot
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/jemalloc-5.2.1_1.catalina.b
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/b1b211e5bead798c236d4
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libev-4.33.catalina.bottle.
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libevent-2.1.12.catalina.bo
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/b5f5e7607d76b9b41ecac
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/nghttp2-1.41.0.catalina.bot
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/d81b96cf82189cd4049ff
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/openldap-2.4.50.catalina.bo
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/c0f1fe7a472cba83a584b
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/rtmpdump-2.4%2B20151223_1.c
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/curl-openssl-7.71.1.catalin
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/3eb7b47868af07e3b766a
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libtool-2.4.6_2.catalina.bo
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/af317b35d0a394b7ef55f
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/unixodbc-2.3.7.catalina.bot
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/03ba378d971af98d07652
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/freetds-1.2.3.catalina.bott
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/6aa188d6d4c85197a3bba
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.10.2.catalina.bo
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/16500bbd77b8bbeb9a4ad
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.32.3.catalina.bott
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/98f798c4a62c9db46cc6a
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/python%403.8-3.8.3_2.catali
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/307604a075d3df682ba45
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/glib-2.64.4.catalina.bottle
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/4ddc126dde12d96499950
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.2.0.catalina.bottle.t
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/2e6acd6e62d1b8ef08000
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libpq-12.3.catalina.bottle.
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/2278f4c6e51a0be17b8fe
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libsodium-1.0.18_1.catalina
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/db372521cd0b1861a5b57
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/libzip-1.7.2.catalina.bottl
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/oniguruma-6.9.5-rev1.catali
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/15241cccbb727a11200b6
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/tidy-html5-5.6.0.catalina.b
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/fb2134180fbdb92cc10f3
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/php-7.4.8.catalina.bottle.t
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/da81ec7dbe2ab2d9cbfcb
######################################################################## 100.0%
==> Installing dependencies for php: apr, apr-util, argon2, aspell, autoconf, brotli, c-ares, libidn, libmetalink, jansson, jemalloc,
libev, libevent, nghttp2, openldap, rtmpdump, curl-openssl, libtool,
unixodbc, freetds, freetype, sqlite, [email protected], glib, gmp, libpq,
libsodium, libzip, oniguruma and tidy-html5
==> Installing php dependency: apr
==> Pouring apr-1.7.0.catalina.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"’ >> ~/.zshrc
==> Summary 🍺 /usr/local/Cellar/apr/1.7.0: 59 files, 1.4MB
==> Installing php dependency: apr-util
==> Pouring apr-util-1.6.1_3.catalina.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"’ >> ~/.zshrc
==> Summary 🍺 /usr/local/Cellar/apr-util/1.6.1_3: 54 files, 785.7KB
==> Installing php dependency: argon2
==> Pouring argon2-20190702_1.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/argon2/20190702_1: 12 files, 599.2KB
==> Installing php dependency: aspell
==> Pouring aspell-0.60.8.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/aspell/0.60.8: 767 files, 322.4MB
==> Installing php dependency: autoconf
==> Pouring autoconf-2.69.catalina.bottle.4.tar.gz 🍺 /usr/local/Cellar/autoconf/2.69: 67 files, 3.0MB
==> Installing php dependency: brotli
==> Pouring brotli-1.0.7.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/brotli/1.0.7: 25 files, 2.2MB
==> Installing php dependency: c-ares
==> Pouring c-ares-1.16.1.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/c-ares/1.16.1: 74 files, 525.7KB
==> Installing php dependency: libidn
==> Pouring libidn-1.35.catalina.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 dependency: libmetalink
==> Pouring libmetalink-0.1.3.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/libmetalink/0.1.3: 31 files, 182.9KB
==> Installing php dependency: jansson
==> Pouring jansson-2.13.1.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/jansson/2.13.1: 11 files, 169.0KB
==> Installing php dependency: jemalloc
==> Pouring jemalloc-5.2.1_1.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/jemalloc/5.2.1_1: 16 files, 2MB
==> Installing php dependency: libev
==> Pouring libev-4.33.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/libev/4.33: 12 files, 454.7KB
==> Installing php dependency: libevent
==> Pouring libevent-2.1.12.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/libevent/2.1.12: 57 files, 1.9MB
==> Installing php dependency: nghttp2
==> Pouring nghttp2-1.41.0.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/nghttp2/1.41.0: 26 files, 2.7MB
==> Installing php dependency: openldap
==> Pouring openldap-2.4.50.catalina.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: P A T H " ′ > > / . z s h r c e c h o ′ e x p o r t P A T H = " / u s r / l o c a l / o p t / o p e n l d a p / s b i n : PATH"' >> ~/.zshrc echo 'export PATH="/usr/local/opt/openldap/sbin: PATH"′>> /.zshrcecho′exportPATH="/usr/local/opt/openldap/sbin:PATH"’ >> ~/.zshrc
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.8MB
==> Installing php dependency: rtmpdump
==> Pouring rtmpdump-2.4+20151223_1.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/rtmpdump/2.4+20151223_1: 20 files, 443.4KB
==> Installing php dependency: curl-openssl
==> Pouring curl-openssl-7.71.1.catalina.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"’ >> ~/.zshrc
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 dependency: libtool
==> Pouring libtool-2.4.6_2.catalina.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 dependency: unixodbc
==> Pouring unixodbc-2.3.7.catalina.bottle.1.tar.gz 🍺 /usr/local/Cellar/unixodbc/2.3.7: 46 files, 1.9MB
==> Installing php dependency: freetds
==> Pouring freetds-1.2.3.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/freetds/1.2.3: 2,072 files, 15.0MB
==> Installing php dependency: freetype
==> Pouring freetype-2.10.2.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/freetype/2.10.2: 61 files, 2.3MB
==> Installing php dependency: sqlite
==> Pouring sqlite-3.32.3.catalina.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"’ >> ~/.zshrc
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 dependency: [email protected]
==> Pouring [email protected]_2.catalina.bottle.tar.gz
==> /usr/local/Cellar/[email protected]/3.8.3_2/bin/python3 -s setup.py --no-user-cfg i
==> /usr/local/Cellar/[email protected]/3.8.3_2/bin/python3 -s setup.py --no-user-cfg i
==> /usr/local/Cellar/[email protected]/3.8.3_2/bin/python3 -s setup.py --no-user-cfg i
==> Caveats Python has been installed as /usr/local/bin/python3
Unversioned symlinks
,
python
,
python-config
etc. pointing to
pip
,
python3
,
python3-config
pip3
etc., respectively, have been
installed into /usr/local/opt/[email protected]/libexec/bin
You can install Python packages with pip3 install 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/[email protected]/3.8.3_2: 4,125 files, 63MB
==> Installing php dependency: glib
==> Pouring glib-2.64.4.catalina.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 dependency: gmp
==> Pouring gmp-6.2.0.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/gmp/6.2.0: 20 files, 3.2MB
==> Installing php dependency: libpq
==> Pouring libpq-12.3.catalina.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"’ >> ~/.zshrc
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.8MB
==> Installing php dependency: libsodium
==> Pouring libsodium-1.0.18_1.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/libsodium/1.0.18_1: 73 files, 1012.8KB
==> Installing php dependency: libzip
==> Pouring libzip-1.7.2.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/libzip/1.7.2: 142 files, 625.2KB
==> Installing php dependency: oniguruma
==> Pouring oniguruma-6.9.5-rev1.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/oniguruma/6.9.5-rev1: 16 files, 1.3MB
==> Installing php dependency: tidy-html5
==> Pouring tidy-html5-5.6.0.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/tidy-html5/5.6.0: 14 files, 2.6MB
==> Installing php
==> Pouring php-7.4.8.catalina.bottle.tar.gz
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set php_ini /usr/local/etc/php/7
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set php_dir /usr/local/share/pea
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set doc_dir /usr/local/share/pea
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set ext_dir /usr/local/lib/php/p
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set bin_dir /usr/local/opt/php/b
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set data_dir /usr/local/share/pe
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set cfg_dir /usr/local/share/pea
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set www_dir /usr/local/share/pea
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set man_dir /usr/local/share/man
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set test_dir /usr/local/share/pe
==> /usr/local/Cellar/php/7.4.8/bin/pear config-set php_bin /usr/local/opt/php/b
==> /usr/local/Cellar/php/7.4.8/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/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.4/
To have launchd start php now and restart at login: brew services
start php Or, if you don’t want/need a background service you can just
run: php-fpm
==> Summary 🍺 /usr/local/Cellar/php/7.4.8: 519 files, 76.1MB
==> Upgrading 5 dependents: imagemagick 7.0.10-21 -> 7.0.10-23, imagemagick 7.0.10-21 -> 7.0.10-23, imagemagick 7.0.10-21 ->
7.0.10-23, imagemagick 7.0.10-21 -> 7.0.10-23, imagemagick 7.0.10-21 -> 7.0.10-23
==> Upgrading imagemagick 7.0.10-21 -> 7.0.10-23
==> Downloading https://homebrew.bintray.com/bottles/imagemagick-7.0.10-23.catal
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/bf19ce6c826be9ab5a42d
############################################# 63.9% curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54 Error: Failed to download resource “imagemagick” Download failed:
https://homebrew.bintray.com/bottles/imagemagick-7.0.10-23.catalina.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2_3.catalin
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/80f141e695f73bd058fd8
######################################################################## 100.0%
==> Downloading https://dl.bintray.com/homebrew/mirror/ImageMagick-7.0.10-23.tar
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/882cecda27265526eb4e7
######################################################################## 100.0%
==> Installing dependencies for imagemagick: pkg-config
==> Installing imagemagick dependency: pkg-config
==> Pouring pkg-config-0.29.2_3.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/pkg-config/0.29.2_3: 11 files, 623.7KB
==> Installing imagemagick
==> ./configure --disable-osx-universal-binary --prefix=/usr/local/Cellar/imagem
==> make install 🍺 /usr/local/Cellar/imagemagick/7.0.10-23: 1,497 files, 25.6MB, built in 2 minutes 4 seconds Removing:
/usr/local/Cellar/imagemagick/7.0.10-21… (1,495 files, 25.5MB)
==> Upgrading imagemagick 7.0.10-23 -> 7.0.10-23
==> Upgrading imagemagick 7.0.10-23 -> 7.0.10-23
==> Upgrading imagemagick 7.0.10-23 -> 7.0.10-23
==> Upgrading imagemagick 7.0.10-23 -> 7.0.10-23
==> Checking for dependents of upgraded formulae…
==> No broken dependents to reinstall!
==> 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"’ >> ~/.zshrc
==> 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"’ >> ~/.zshrc
==> 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: P A T H " ′ > > / . z s h r c e c h o ′ e x p o r t P A T H = " / u s r / l o c a l / o p t / o p e n l d a p / s b i n : PATH"' >> ~/.zshrc echo 'export PATH="/usr/local/opt/openldap/sbin: PATH"′>> /.zshrcecho′exportPATH="/usr/local/opt/openldap/sbin:PATH"’ >> ~/.zshrc
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"’ >> ~/.zshrc
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"
For pkg-config to find curl-openssl you may need to set: export
PKG_CONFIG_PATH="/usr/local/opt/curl-openssl/lib/pkgconfig"
==> libtool In order to prevent conflicts with Apple’s own libtool we have prepended a “g” so, you have instead: glibtool and glibtoolize.
==> 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"’ >> ~/.zshrc
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"
For pkg-config to find sqlite you may need to set: export
PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"
==> [email protected] Python has been installed as /usr/local/bin/python3
Unversioned symlinks
,
python
,
python-config
etc. pointing to
pip
,
python3
,
python3-config
pip3
etc., respectively, have been
installed into /usr/local/opt/[email protected]/libexec/bin
You can install Python packages with pip3 install 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
==> 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"’ >> ~/.zshrc
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"
For pkg-config to find libpq you may need to set: export
PKG_CONFIG_PATH="/usr/local/opt/libpq/lib/pkgconfig"
==> php To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php/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.4/
To have launchd start php now and restart at login: brew services
start php Or, if you don’t want/need a background service you can just
run: php-fpm
MySQL 8.0.19 設定簡單密碼
(base) ➜ ~ mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT can be used to test passwords and improve
security. It checks the strength of password and allows the users to
set only those passwords which are secure enough. Would you like to
setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: y
There are three levels of password validation policy:
LOW Length >= 8 MEDIUM Length >= 8, numeric, mixed case, and
special characters STRONG Length >= 8, numeric, mixed case, special
characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 Please set the
password for root here.
New password:
Re-enter new password:
Estimated strength of the password: 50 Do you wish to continue with
the password provided?(Press y|Y for Yes, any other key for No) : y By
default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from ‘localhost’.
This ensures that someone cannot guess at the root password from the
network.
Disallow root login remotely? (Press y|Y for Yes, any other key for
No) :
… skipping. By default, MySQL comes with a database named ‘test’
that anyone can access. This is also intended only for testing, and
should be removed before moving into a production environment.
Remove test database and access to it? (Press y|Y for Yes, any other
key for No) :
… skipping. Reloading the privilege tables will ensure that all
changes made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No)
- y Success.
All done! (base) ➜ ~ mysql -uroot -p12345678 mysql: [Warning] Using a
password on the command line interface can be insecure. Welcome to the
MySQL monitor. Commands end with ; or \g. Your MySQL connection id is
11 Server version: 8.0.19 Homebrew
Copyright © 2000, 2020, Oracle and/or its affiliates. All rights
reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input
statement.
mysql> exit Bye