当前位置: 首页 > news >正文

MACBOOK 调教指北

以下都是本人在使用macOS Mojave v10.14.6 实际遇到的问题:

1、切换到root用户

$sudo su
Password:?
sh-3.2# 

2、为系统自带的php安装pcntl扩展

$php -v
No log handling enabled - using stderr logging
Created directory: /var/db/net-snmp
Created directory: /var/db/net-snmp/mib_indexes
PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
$curl -O https://www.php.net/distributions/php-7.1.23.tar.gz
$tar zxvf php-7.1.23.tar.gz
$cd php-7.1.23/ext/pcntl
$phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:        
Zend Module Api No:     
Zend Extension Api No:  

头文件一个都没有,解决方案,重新安装后即可。

$ xcode-select --install
$ cd /Library/Developer/CommandLineTools/Packages/
$ open macOS_SDK_headers_for_macOS_10.14.pkg

3 3、/usr/lib不可写问题,root都不行

# cp pcntl.so /usr/lib/php/extensions/no-debug-non-zts-20160303/
cp: /usr/lib/php/extensions/no-debug-non-zts-20160303/pcntl.so: Operation not permitted

因为 新的macOS 启用了 SIP (System Intergerity Protection)功能,导致 root 用户也没有权限修改。Rootless机制将成为对抗恶意程序的最后防线
禁用此项功能步骤如下:

  1. 重启电脑
  2. command + R 进入 recover 模式
  3. 点击最上方的菜单使用工具,选择终端
  4. 运行命令 csrutil disable
  5. 当出现 successfully 字样代表成功,重启电脑就可以了。
-bash-3.2# csrutil disable
Successfully disabled System Integrity Protection. Please restart the machine for the changes to take effect.
-bash-3.2#

PS:如果需要重新开启这个 SIP 功能,重复上面布置,只是第四步的命令是 csrutil enable

4、 安装Brew并 修改为国内源

#安装
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#换源
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 替换homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# 刷新源
brew update

5、升级到MacOS 10.15 Catalina后权限问题

为了能使用sidecar,第一时间升级了正式版的10.15,升级后发现workerman不能用了,提示PCNTL没有。检查后发现系统PHP升级到7.3.8了,重新下载源码包,重新编译吧,遇到一些10.14有区别的地方。
部分内容参考:macOS软件编译时找不到头文件解决方法[更新10.15]

$ csrutil status #确保SIP功能是关闭状态
$ xcode-select #安装开发工具文件头等
$ sudo mount -uw /	# 根目录挂载为可读写,否则无法在/usr/下建立文件,本修改重启前有效。
$ sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include include
$ sudo DevToolsSecurity -enable # 将系统置于开发模式
$ cd ~/Downloads/PHP-7.3.8/ext/pcntl #进入PHP源码包
$ phpize
$ ./configure
$ make && make install
$ sudo cp moudle/pcntl.so /usr/lib/php/extensions/no-debug-non-zts-20180731/
$ php -m #检查加载情况

我在加载根分区读写权限后,怎么也无法cp到/usr/lib,前后耽误了1天,后来才想起来,必须用sudo来执行,哭,白白浪费1天的时间。

相关文章:

  • 关于Apache无法加载PHP 7.2 curl模块问题的解决办法
  • 墙脆脆?!
  • 在群晖DS218+上编译Fluffos的Docker镜像
  • 将自己的SSH密钥对导入YubiKey 5的PIV和智能卡模块,配合Putty和XShell使用
  • 快照(Snapshot)技术发展综述
  • 国产开源硬件力作CanoKey,替代昂贵的Yubikey!
  • 在CentOS上升级OpenSSL 1.1.1k
  • firewall-cmd 常用命令
  • 俞敏洪在北京大学2008年开学典礼上的发言
  • iptables 之 REJECT 与 DROP 对比
  • Nginx捕获并自定义proxy_pass返回的错误
  • 后台传JSON,前台动态生成一个下拉框
  • PostgreSQL psql工具使用方法
  • 在后台把DataTable组织成JSON,送到前台动态填充UltraWebGrid
  • Win10以后的版本不支持文件拖动打开的解决办法
  • 4月23日世界读书日 网络营销论坛推荐《正在爆发的营销革命》
  • Apache Pulsar 2.1 重磅发布
  • AWS实战 - 利用IAM对S3做访问控制
  • java B2B2C 源码多租户电子商城系统-Kafka基本使用介绍
  • js学习笔记
  • Python socket服务器端、客户端传送信息
  • Python 基础起步 (十) 什么叫函数?
  • Redis学习笔记 - pipline(流水线、管道)
  • vue-cli在webpack的配置文件探究
  • 基于Volley网络库实现加载多种网络图片(包括GIF动态图片、圆形图片、普通图片)...
  • 排序算法学习笔记
  • 为物联网而生:高性能时间序列数据库HiTSDB商业化首发!
  • Oracle Portal 11g Diagnostics using Remote Diagnostic Agent (RDA) [ID 1059805.
  • ​DB-Engines 12月数据库排名: PostgreSQL有望获得「2020年度数据库」荣誉?
  • ​什么是bug?bug的源头在哪里?
  • # Python csv、xlsx、json、二进制(MP3) 文件读写基本使用
  • (多级缓存)缓存同步
  • (二)linux使用docker容器运行mysql
  • (分布式缓存)Redis持久化
  • (一)Thymeleaf用法——Thymeleaf简介
  • (转)C#调用WebService 基础
  • (转)socket Aio demo
  • ***原理与防范
  • .aanva
  • .NET CORE 2.0发布后没有 VIEWS视图页面文件
  • .NET 反射的使用
  • .Net下的签名与混淆
  • .NET中使用Redis (二)
  • .secret勒索病毒数据恢复|金蝶、用友、管家婆、OA、速达、ERP等软件数据库恢复
  • :“Failed to access IIS metabase”解决方法
  • @font-face 用字体画图标
  • [28期] lamp兄弟连28期学员手册,请大家务必看一下
  • [AI Google] 使用 Gemini 取得更多成就:试用 1.5 Pro 和更多智能功能
  • [Cloud Networking] Layer3 (Continue)
  • [CSS] - 修正IE6不支持position:fixed的bug
  • [exgcd] Jzoj P1158 荒岛野人
  • [FreeRTOS 基础知识] 栈
  • [LeetBook]【学习日记】获取子字符串 + 颠倒子字符串顺序
  • [lesson17]对象的构造(上)
  • [Linux]创建新用户并授予root权限