MacBook Air M4 折腾记录02

找到了一篇mac入门的博客,看着很不错

https://imageslr.com/2020/03/19/mac-initialization.html

查看隐藏文件

command+shift+.

Homebrew

https://brew.sh/

安装

我参考的安装方式:https://blog.csdn.net/min4233/article/details/147356039

其他安装方式:

  • pkg下载:https://github.com/Homebrew/brew/releases/tag/4.6.3
  • shell安装:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

报错

安装zsh插件报错,我一开始是shell直接安装包这个错误,后面参考博客就没有了

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
    arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
    arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.

应用-WindTerm

https://github.com/kingToolbox/WindTerm/releases

老用户了好用,mac装一下看看有没有什么小问题

oh my zsh !

参考博客:https://www.haoyep.com/posts/zsh-config-oh-my-zsh/

官方网址:https://ohmyz.sh/#install

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

我选的主题是daveverwer

内置自动补全功能

默认 oh-my-zsh 命令自动补全功能如下

  • 自动列出目录

    输入 cd 按 tab 键,目录将自动列出,在按 tab 可以切换

  • 自动目录名简写补全

    要访问 /usr/local/bin 这个长路径,只需要 cd /u/l/b 按 tab 键自动补全

  • 自动大小写更正 (sysin)

    要访问 Desktop 文件夹,只需要 cd de 按 tab 键自动补全,或者查看 README.md,只需要 cat rea 自动更正补全

  • 自动命令补全

    输入 kubectl 按 tab 键即可看到可用命令

  • 自动补全命令参数

    输入 kill 按 tab 键会自动显示出进程的 process id

小技巧

可以忽略 cd 命令,输入 .. 或者 ... 和当前目录名都可以跳转。

上述功能不需要额外的插件。

插件

zsh-autosuggestions

https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh

  1. Install command:

    brew install zsh-autosuggestions
    
  2. To activate the autosuggestions, add the following at the end of your .zshrc:

    source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
    
  3. Start a new terminal session.

zsh-syntax-highlighting

https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md

brew install zsh-syntax-highlighting
echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc

应用-Stats

监控cpu、网速等等信息

https://mac-stats.com/

应用-Snipaste

https://zh.snipaste.com/download.html

截屏软件好用

快速操作

从ubuntu切换到mac后,不能快速打开终端这点太难受了

参考这个设置:https://www.hjxfire.cn/2018/04/30/Mac-add-shortcuts/

ncdu

brew install ncdu
cd /
ncdu .
#按方向盘上的左右可以进入子目录继续查看或者返回上一级,按 q 退出