mac brew 切换源

切换到国内源

# 替换brew.git:
cd "(brew --repo)"
# 中国科大:
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 清华大学: git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

# 替换homebrew-core.git:
cd "(brew --repo)/Library/Taps/homebrew/homebrew-core"
# 中国科大:
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 清华大学: git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

# 替换homebrew-bottles:
# 中国科大:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.zsh_profile
# 清华大学:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile source ~/.zsh_profile

# 应用生效:
$ brew update

切换到官方源

# 重置brew.git:
cd "(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

# 重置homebrew-core.git: cd "(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core.git

 

mac下开发 github 上传大于 50M的文件 git-lfs

Homebrewbrew install git-lfs
MacPortsport install git-lfs

1、安装git和git-lfs,然后运行:

`git lfs install`

2、添加你要上传的大文件例如:

git lfs track "*.psd"

确保.gitattributes is tracked:

git add .gitattributes

3、开始推送:

git add file.psd
git commit -m "Add design file"
git push origin master

参考网站:https://git-lfs.github.com/

mac上遇到的错误sed command a expects followed by text

mac上简单的替换操作

sed -i 's/apple/mac/g' full-path-file
执行后报错,“sed: 1: command a expects \ followed by text”
由于mac系统与linux系统下sed用法的差异,下面给出两种解决方案
(差异可自己在两个系统用man命令查看帮助)
第一种解决方案

sed命令改写为

sed -i '' 's/apple/mac/g' full-path-file
第二种解决方案调整macsed的用法,使其与linux一致
mac上安装gnu-sed
brew install gnu-sed
alias sed=gsed

调整后两系统下sed的用法完全一致。

注意添加PATH=/usr/local/opt/gnu-sed/libexec/gnubin:/$PATH

Intel82574L 黑苹果 原生网卡修改支持

1、查找该网卡的设备ID,经查,设备ID为10d38086

2、修改/System/Library/Extensions/IONetworkingFamily.kext/Contents/PlugIns/Intel82574L.kext/Contents/Info.plist

3、查找
IOClass 

Intel82574L
IOPCIPrimaryMatch

4、将 IOPCIPrimaryMatch 改为 IOPCIMatch.
5、修改 IOPCIMatch的下一行,为0x10d38086
6、删除接下来的2行
7、使用kext utility类工具修复权限和重建cache
8、reboot

macOS 中使用 phpize 动态添加 PHP 扩展的错误解决方法

问题一:

执行 phpize 报错如下:

$ 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:

浏览全部