Category: macOS

  • 挂载远程 sftp 目录至 mac OSX 本机目录

    安装所需 osxfuse

    brew cask install osxfuse
    brew install sshfs
    

    把远程目录 /data/v 挂载到 ~/v 目录下

    sshfs -p 22 -o reconnect -o volname=v -o IdentityFile=~/.ssh/id_rsa [email protected]:/path/to/wherever /Volumes/SomeNiceName
    

    参考:

    SSHFS mount remote drive in finder

  • reset mac usb

    This is how to reset SMC on most modern Mac laptops, none of which have a removable battery:

    Shutdown your MacBook Air / MacBook Pro
    Connect the power adapter to the Mac
    On the MacBook / Pro’s keyboard, hold down the Shift+Control+Option keys and the Power button at the same time
    Release all keys and the power button at the same time – the little light on the MagSafe adapter may change colors briefly to indicate the SMC has reset
    Boot your Mac as usual

    When and How to Reset Mac SMC (System Management Controller)

    https://support.apple.com/zh-cn/HT201295

  • reset chrome on mac

    清理 mac 下的 chrome

    rm -rf  ~/Library/Application\ Support/Google
    
    rm -rf ~/Library/Caches/Google
    rm -rf ~/Library/Caches/com.google.Chrome
    rm -rf ~/Library/Caches/com.google.Keystone
    rm -rf ~/Library/Caches/com.google.Keystone.Agent
    rm -rf ~/Library/Caches/com.google.SoftwareUpdate
    
    rm -rf ~/Library/Google/Google\ Chrome*
    
  • 解决烦人的 chrome 选择证书提示

    当使用自签的证书时,chrome 会不停地提示选择证书

    已经被烦了几个月了,每次选择很浪费时间。还好 chrome 提供了自动选择证书 policy。

    为名字为 AutoSelectCertificateForUrls 的 policy 创建规则

    mac OSX 系统设置

    # 清空这个选项的内容
    defaults write com.google.Chrome AutoSelectCertificateForUrls -array
    # 设置 policy
    defaults write com.google.Chrome AutoSelectCertificateForUrls -array-add -string '{"pattern":"https://[*.]corp.foobar.com","filter":{"ISSUER":{"CN":"Foobar Internal Intermediate CA"}}}'
    

    windows 新建一个 .reg 注册表文件,之后双击导入

    Windows Registry Editor Version 5.00
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\AutoSelectCertificateForUrls]
    "1"="{\"pattern\":\"https://[*.]corp.foobar.com\",\"filter\":{\"ISSUER\":{\"CN\":\"Foobar Internal Intermediate CA\"}}}"
    
    

    检查 policy 是否生效,地址栏输入 chrome://policy

    重新载入 policy,在最右侧的状态里看到是 ok 的则生效(如果上面写错,检查 json 语法,以及 CN,CN 是 iusser 的 common name)。

    官方文档: https://chromium.org/administrators/policy-list-3#AutoSelectCertificateForUrls

  • mac cleanup

    1. brew cleanup 清理不用的 软件包,可能会只保留最新版,实测释放了 3GB 空间
    2. docker Docker.qcow2 在使用过程中会一直增长,如果你是无状态的 docker ,可以 Preferences => resource => advanced => Disk Image Size 调整大小(所有镜像和 docker 都会被删), 实测释放 14GB 空间
    3. 微信 => 通用 => 存储空间 => 前往清理
    4. 微信 => 备份与恢复 => 管理备份文件
    5. 查找大于 1GB 的单个文件 ( sudo find / -size +1GB )