Mac 配置(Mac Apple Chip)

1,389 阅读1分钟

命令行工具

Homebrew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
  • homebrew安装路径在/opt/homebrew/Cellar/下

iterm2

  • brew install iterm2

key map 设置

oh-my-zsh

git clone git@github.com:powerline/fonts.git
cd fonts
./install.sh

image.png

  • 主题:
vim ~/.zshrc
ZSH_THEME=agnoster
  • 配色方案:preferences->profiles->color presets
  • 插件
    • 自动补全zsh-autosuggestions
    git clone https://gitee.com/phpxxo/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    vim ~/.zshrc
    plugins=(
      git
      zsh-autosuggestions
    )
    source ~/.zshrc
    
    • 语法高亮zsh-syntax-highlighting
    brew install zsh-syntax-highlighting
    vim ~./zshrc
    source xxx/xxx/zsh-syntax-highlighting.zsh(这个具体路径第一步时候会有)
    source ~/.zshrc
    
    • autojump安装
    brew install autojump
    [ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh(这个具体命令第一步有)
    source ~/.zshrc
    
  • 更新之后出现 o20vXnHY4C.jpg
chmod 755 zsh
chmod 755 xxx/site-functions

问题:fatal: not in a git directory

git config --global --add safe.directory 你的homebrew-core路径
git config --global --add safe.directory 你的homebrew-cask路径
git config --global --add safe.directory 你的homebrew-services路径

alias设置

vim ~/.zshrc
找到alias示例地方进行添加
source ~/.zshrc

consul

brew install consul

consul

tree命令

brew install tree

MySQL

  • 官网下载arm版本
  • 进安装包一步步默认,设置root密码(如果无法打开.pkg,进入system perference的security & privacy,查看Allow apps downloaded from相关选项)
  • 修改~/.zshrc添加
export PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:/usr/local/mysql/support-files
  • system perference查看MySQL是否启动
  • Iterm2进入MySQL
mysql -u root -p

Sequel Pro(官网

1.2

1.1

  • 连接MySQL:
    • Host:127.0.0.1
    • Name:root
    • Password:你的密码
  • 连接失败显示Connection failed解决办法
    • System perference里MySQL
    • image.png
    • image.png

github

  • 第一步会一起安装git
  • github连接
  • git clone用git@xxx不用https

Dokcer

docker --version
docker --info

Nginx

brew install nginx

nginx -v

编程相关

golang编译环境

brew install go
vim ~/.zshrc

添加以下内容:
# Go
export GOPATH=/(你自己的路径)
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
# Go END
#GO module
export GO111MODULE=on
export GOPROXY=https://mirrors.aliyun.com/goproxy/ 

go version
go env

goland插件

  • Atom Material Icons
  • GitToolBox
  • Gopher
  • Key Promoter X
  • Material Theme UI
  • Rainbow Brackets
  • Tabnine
  • Translation

mac系统:zsh切换bash提示chsh: no changes made问题

python环境

翻译插件

快捷键:Command + Control + U 配置使用百度,谷歌不能用了,有道收费,认证之后开通一下高级版

protobuf

cd /usr/local/
sudo mkdir protobuf
#移过去
mv protobuf-all-3.20.1.tar.gz /usr/local/protobuf

#修改环境变量
vim ~/.zshrc

# protobuf 
export PROTOBUF=/usr/local/protobuf 
export PATH=$PROTOBUF/bin:$PATH

#更新环境变量
source ~/.zshrc

#解压
tar zxvf protobuf-all-3.20.1.tar.gz

#安装
cd protobuf-3.20.1/
sudo ./configure
sudo make
sudo make check
sudo make install

#检验
protoc --version

另一种方法(!用这个)

brew install protobuf protoc-gen-go protoc-gen-go-grpc
  • 注:如果homebrew遇到问题,使用brew doctor尝试解决

swag安装

  • 如果有问题去看官方文档,不要吃二手资料
go install github.com/swaggo/swag/cmd/swag@latest

mv $GOPATH/bin/swag /usr/local/go/bin(maybe不用也行)

swag -v

go get -u -v github.com/swaggo/gin-swagger
go get -u -v github.com/swaggo/files
go get -u -v github.com/alecthomas/template


Chrome 插件扩展

插件应用