Mac: 新电脑如何配置 get-started/cherry/键盘

自己的系统或者新电脑的配置
更新于: 2024-03-12 08:57:40

一切的前提

切换 bash

# 将默认修改为 bash
chsh -s /bin/bash
# 查看
echo $SHELL 

安装 homebrew

绿色版软件

安装 fnm nodejs环境

配置编程环境

安装 rime输入法

截图软件

brew search snipaste
brew install snipaste wget autojump

下载

设置 hostname

  • 自己mbp13: -
  • 公司的macbook: a7-13mbp
  • 公司的macmini: aric.local
# 自己的
sudo hostname aric-MBP13
# 公司的
sudo hostname aric-a7

nvm安装

vscode 配置

  • syncKey: 78f15ef102d4a556628f902aac6a8990
{
    "sync.autoDownload": true,
    "sync.autoUpload": true,
    "sync.forceDownload": true,
    "sync.forceUpload": true,
    "sync.gist": "78f15ef102d4a556628f902aac6a8990"
}

安装基础软件

brew install wget autojump starship go pwgen jq

安装brew

记得挂代理,否则有可能 443(https相关) 连不上

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Mac OS X安装gnu-sed/gnu-tar等命令行工具

Alfred使用技巧

配置 ssh/backup/settings 项目

  • dotfiles: 存放一些 ssh/github/npm 等登录的重要信息
  • settings: 关于 bash 的一些个性化配置插件
  • backup: alfred 等重要软件的配置备份
https://github.com/afeiship/dotfiles
https://github.com/afeiship/mac-settings
https://github.com/afeiship/macos-backup
https://github.com/afeiship/ip-sync

使用 weak passwod(弱密码)

  • 1-5步:修改 pwpolicy
  • 第4步: 注意在 temp.xml 头上会多一行,删除才能进行这一步
  • 第6步: 这个可以直接使用 macos 的 Users & Groups → Change Password 来完成
  • 实际上是修改了: '^$|.{4,}+' 改成 '^$|.{1,}+'

注意,如果是老系统(测试过: 10.13.6),直接修改为简单密码即可,不需要这么麻烦的过程。

# 1. switch to root user
sudo su -

# 2. export policy data
pwpolicy getaccountpolicies > temp.xml

# 3. modify policy data
# Change the policy eg 4 characters down to 1 on the line:
<string>policyAttributePassword matches '^$|.{1,}+'</string>

# 4. import policy data
pwpolicy setaccountpolicies temp.xml

# 5. delete temp.xml
rm temp.xml

# 6. set password at least 1
passwd <account you want to change>

修改密码

修改密码截图

干掉 Siri

siri 设置

禁止网页前进后退手势

Settings → Trackpad → More Gestures → Swipe between pages.

三指拖动

  • 选取苹果菜单 >“系统设置”(或“系统偏好设置”)。
  • 点按“辅助功能”。
  • 点按“指针控制”(或“鼠标与触控板”)。
  • 点按“触控板选项”按钮。
  • 打开“使用触控板进行拖移”(或“启用拖移”)。
  • 从弹出式菜单中,选取“三指拖移”拖移样式。
  • 点按“好”。

 

安装编程字体

  • 用 ssh 安装会比 https 快(当你访问github有问题的情况下)
  • 默认这个问题是用 Powerline 字体的时候会出现
有字体问题
安装之后
# to dir
cd ~/software
# clone
git clone --depth=1 git@github.com:powerline/fonts.git
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

配置vim

# 安装 vbundle 管理 vim 插件
vim-init
# 进入 vim 安装插件
vim-install

Proxy 与 VPN

@deprecated 这个功能,已经添加到 dotfiles 里了,这里不用了。

git clone git@github.com:aric-server/proxy.git
cd proxy
npm run install

# 验证
which proxy

常用的 app

名称备注
Magnet窗口管理
Alfred装机神器
钉钉/Tencent Meeting/WeCom/微信装机,工作常用工具
cd2一个可以在 finder上显示 terminal的小众APP
安装可以使用的ps2020<绿色版>https://www.weiyun.com/disk/folder/4efd4705789718c2d43ca42f90722fe9

硬 proxy

http_proxy=http://127.0.0.1:9090 https_proxy=http://127.0.0.1:9090 YOUR_ACTION

安装 brew

unable to access 'https://github.com/Homebrew/brew/': LibreSSL SSL_connect

解决方案

设置临时的 proxy,安装好之后,再删除即可。

git config --global http.proxy "socks5://127.0.0.1:9091"
git config --global http.sslBackend "openssl"

然后安装

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
git config --global --unset http.sslBackend
git config --global --unset http.proxy

隐藏 alfred 图标

截图快捷键

截图快捷键设计

双指右键

  • Settings → Trackpad → Tap to click

远程登录

一般公司电脑经常会用这个设置

关闭听写

Settings → Keyboard → Dictation

有时候,连续2次 ctrl 就会触发这个功能,特别麻烦,在这里可以关闭掉。

关闭听写提示

Fn 组合 f1-f12

Settings → Keyboard → Use F1, F2 ….

好用的 F11 debug 功能

Chrome 默认的 f11 与系统的显示桌面冲突,所以这里关闭。

chrome显示完整网址

 

修复 Java 问题

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

安装 ruby 组件

gem install bundler
gem install whenever
brew install lunchy

SourceTree 各种版本

15年老程序员配置过程

cherry 键映射

多屏内容拖拽
鼠标设置截图

cherry键盘alt+tab快捷键失效

解决办法:FN+F9。。这组组合键好像是切换windows和mac的,如果在mac下,好像不支持alt+tab,没用过mac,昨天新回来的键盘,试了一圈操作,误锁了可能,今晚切换不了了。

Alfred

备份路径设置: ~/github/macos-backup/alfred 即可

配置界面

参考