Mac工作环境配置

外部文件:

.vimrc

基础配置

系统偏好正常设置即可。

super+shift+. 显示隐藏文件。

软件:搜狗输入法,Chrome,XCode,Parallel Desktop/Toolbox,LaTeX,ForkLift,The Unarchiver,Steam,Github Desktop,Clean One Pro,WPS,MS Office,Typora,qBittorrentClashX

Shell

一篇教程另一篇教程

  1. 安装homebrew:复制主页命令直接执行即可;
  2. 安装iTerm2:brew install iterm2;
  3. 安装zsh:
1
2
3
4
5
6
7
8
9
cat etc/shells
echo $SHELL
#若没有zsh:
brew install zsh
#若默认不是zsh:
chsh -s /bin/zsh

vim ~/.zshrc
source ~/.bash_profile
  1. 安装oh my zsh:复制主页命令直接执行即可
1
2
3
4
5
6
7
8
9
10
11
12
13
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/zsh-users/zsh-autosuggestions.git
git clone https://github.com/zsh-users/zsh-completions.git
# brew默认安装至/usr/local/Cellar/故以下命令可能无效:
brew install zsh-autosuggestions zsh-syntax-highlighting zsh-completions

vim ~/.zshrc # 找到plugins=(git)
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)
  1. 安装powerlevel10k主题:
1
2
3
4
5
6
7
8
9
10
cd ./oh-my-zsh/themes
git clone https://github.com/romkatv/powerlevel10k.git

vim ~/.zshrc
ZSH_THEME="powerlevel10k/powerlevel10k"

# 退出,重新进入配置powerlevel10k
# 如果powerlevel下载字体失败:
brew tap homebrew/cask-fonts
brew install --cask font-sauce-code-pro-nerd-font
  1. vim配置:
1
2
3
4
5
6
7
8
复制.vimrc

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

将 https://github.com/w0ng/vim-hybrid/blob/master/colors/hybrid.vim 复制到:
~/.vim/colors/hybrid.vim

:PluginUpdate

语言环境

C++

Mac OS自带Clang+LLVM版G++。

Python

Mac自带非最新版本Python,用brew install python下载最新。

Java

Oracle官网下载JDK,然后修改环境变量。

1
2
3
4
5
6
/usr/libexec/java_home #获取安装目录
/Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home

vim ~/.bash_profile
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH

C

下载或brew install dotnet

1
2
3
4
5
6
7
8
9
10
11
mkdir csharp && cd csharp
dotnet new console
dotnet restore
dotnet run

# 若出错:
brew update
brew install openssl
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
brew link --force openssl

IDE

Sublime

官网下载

Package Control,若失败:

1
ln -sf /usr/local/Cellar/openssl@1.1/1.1.1o/lib/libcrypto.dylib /usr/local/lib##/

VScode

官网下载

换用国内源:将下载地址中的az764295.vo.msecnd.net 更换为  vscode.cdn.azure.cn