943

MacOS查看端口命令

netstat 命令

例如:查看所有监听的端口

netstat -nat |grep LISTEN

例如:查看9000端口

netstat -nat |grep 9000
# 示例输出
tcp4       0      0  127.0.0.1.9000         *.*                    LISTEN
1099

MacOS使用brew services 和 launchctl管理服务

前言

MacOS可以使用launchctl命令管理服务,也可以使用brew services

brew services 相比 launchctl,操作更简化,更加类似 Centos 的 systemd 命令。

brew services常用命令

启动、停止服务

例如:启动nginx

brew services start nginx

例如:停止php-fpm

brew services stop php
891

MacOS使用Brew安装PHP和PHP扩展的安装

安装PHP

直接使用brew命令安装即可

brew install php

安装指定版本

brew install php@7.2

安装PHP扩展

MacOS下使用pecl安装PHP扩展

查看pecl

pecl version
986

Macos更换Homebrew为腾讯源

安装homebrew

如果还未安装homebrew的话,使用以下命令安装

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

卸载命令

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"

Step1:更换brew源

查看

cd "$(brew --repo)" && git remote -v

更换

git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/brew.git

Step2:更换homebrew-core源(注意:brew v4 不需要此步)

385

docker访问宿主机

host模式,容器内共享宿主机的网络

--network host