homebrew 执行 brew update 报 rebase-merge 错误问题解决

错误信息

Running `brew update --auto-update`...
fatal: It seems that there is already a rebase-merge directory, and
I wonder if you are in the middle of another rebase.  If that is the
case, please try
    git rebase (--continue | --abort | --skip)
If that is not the case, please
    rm -fr ".git/rebase-merge"
and run me again.  I am stopping in case you still have something
valuable there.

浏览全部

Mac 苹果 id 多帐号切换工具 Account-Switcher

Account-Switcher 是一款免费开源的 mac 平台 apple id 切换工具,可以添加多个 id 进行快速切换,提高效率。

通过终端工具安装,复制命令并回车进行安装与卸载。

安装

brew tap bigwig-club/brew
brew  install --cask bigwig-club/brew/account-switcher

卸载

brew  uninstall --cask bigwig-club/brew/account-switcher
brew untap bigwig-club/brew

mac 开机启动frpc 服务

为啥会有这篇文章

因为docker for mac/windows 不支持 –net=host,跑在docker下很不方便穿透宿主机。

下载frpc的二进制文件以及 frpc.ini文件

都放在 /Users/apple/Workspace/docker-frpc 下,此处以这个目录为例,请自行修改自己的对应的目录地址

配置frpc.plist

sudo vim ~/Library/LaunchAgents/frpc.plist

文件内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>frpc</string>
<key>ProgramArguments</key>
<array>
<string>/Users/apple/Workspace/docker-frpc/frpc</string>
<string>-c</string>
<string>/Users/apple/Workspace/docker-frpc/frpc.ini</string>
</array>
<key>KeepAlive</key>
<true></true>
<key>RunAtLoad</key>
<true></true>
</dict>
</plist>

配置权限

sudo chown root ~/Library/LaunchAgents/frpc.plist

加载配置文件

sudo launchctl load -w ~/Library/LaunchAgents/frpc.plist

取消加载(不想后续继续用了)

sudo launchctl unload -w ~/Library/LaunchAgents/frpc.plist

好了,教程到此结束,下课

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:

浏览全部