在我计划外的,本意想要拒绝M1芯片的,因为做为开发者,有的编译库和软件真的害怕出现兼容问题,编译不过。结果申请下来的意外成了M1 Pro。也罢。尝试一下吧。
搞完以后,一定要重启一下,否则某些应用,没有系统环境!
这一部分,纯属个人习惯。外面推荐zsh+o my zsh。百度搜索如何切换。
chsh -s /bin/bash 选择。
chsh -s /bin/zsh
BSD切为GNU,解决shell脚本因为命令,比如grep,sed, ls都不太对。
部分参考来自https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
第一步,安装brew,国内推荐使用镜像站:
#默认
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
#使用镜像站
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
新
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
按照提示添加环境变量。(不一定提示如下,不用写)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/allan/.bash_profile
eval "$(/opt/homebrew/bin/brew shellenv)"
第二步,安装命令:
–with-default-names 现在已经不需要了。
#1.必装
brew install coreutils
#2.必装
brew install binutils
brew install diffutils
brew install findutils
#2.1 个人补充 ctags通过which -a ctags检查和which ctags
brew install ctags-exuberant
#3.自己选熟悉的装,不用追加with default names了。
brew install gawk
#brew install gnu-indent --with-default-names
brew install gnu-sed --with-default-names
brew install gnu-tar --with-default-names
#brew install gnu-which --with-default-names
#brew install gnutls
brew install grep --with-default-names
#brew install gzip
#brew install screen
#brew install watch
#brew install wdiff --with-gettext
#brew install wget
#mac版本想更新的部分 暂时不建议更新
brew install bash
brew install emacs
brew install gdb # gdb requires further actions to make it work. See `brew info gdb`.
brew install gpatch
brew install less
brew install m4
brew install make
brew install nano
#mac版本不是GNU的而是BSD,可以换一下,但是我没执行也建议暂时不用修改
brew install file-formula
brew install git
brew install openssh
brew install perl
brew install python
brew install rsync
brew install svn
brew install unzip
brew install vim --override-system-vi
brew install macvim --override-system-vim --custom-system-icons
brew install zsh
最后追加环境变量如下到bashrc中去:
export ANDROID_HOME=/Users/allan/Library/Android/sdk/platform-tools
export BREW_CORE_HOME=/opt/homebrew/opt/coreutils/libexec/gnubin
export BREW_FIND_HOME=/opt/homebrew/opt/findutils/libexec/gnubin
export BREW_SED_HOME=/opt/homebrew/opt/gnu-sed/libexec/gnubin
export BREW_TAR_HOME=/opt/homebrew/opt/gnu-tar/libexec/gnubin
export BREW_GREP_HOME=/opt/homebrew/opt/grep/libexec/gnubin
export PATH="$ANDROID_HOME:$FFMPEG_HOME:$HOME/bin:$JAVA_HOME:$BREW_GREP_HOME:$BREW_TAR_HOME:$BREW_CORE_HOME:$BREW_SED_HOME:$BREW_FIND_HOME:${PATH}"
一般情况我们使用1.8环境。偶尔使用jdk17的时候,切换一下,source下bashrc or zshrc即可。
# oracel JDK17+ 有M1的版本注意下载正确
# jdk1.8 (截止2022.03没有M1版本,网上有zulu 支持1.8最新)
#下载完成后,解压到某个目录。追加环境变量到PATH中。
#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
#export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
export JAVA_HOME=/Users/allan/Documents/jdk1.8.0.322aarch64_zulu/zulu-8.jdk/Contents/Home
#export JAVA_HOME=/Users/allan/Documents/jdk-17.0.2.jdk/Contents/Home
export PATH="$JAVA_HOME:xxxxxxxxx:${PATH}"
.gitconfig
软件列表:
Xcode
Xcode command line 开发者推荐某些跨平台端开发必须是使用
VSCode
beyond compare 不会吧不会吧?还有人不认识他
Hex fiend 二进制浏览工具
The unarchiver 解压软件某些rar或者系统自带解压不够强大的时候使用
github搜索jadx android、aar、jar反编译
github搜索jd-gui jar浏览器
mat 独立的内存泄漏分析工具 http://www.eclipse.org/mat/downloads.php
typora markdown。可以下载最后一个beta版本0.11.18后续需要收费
Paste 个人习惯:复制粘贴程序谁用谁知道
搜狗输入法 个人习惯
proguard 个人习惯:混淆工具 一般不用
Dozer 个人习惯:mac状态栏双点收纳
另外,以下软件列表都有M1 chip或者intel chip(芯片)对应版本,准确下载。否则程序慢5-10倍:
android studio
IDEA
microsoft edge浏览器
VLC播放器
https://www.jetbrains.com/lp/mono/
终端颜色配置方案:改名为xxx.terminal双击,然后在terminal使用当前作为默认即可:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAcMSAwLjk0OTAxOTYwNzggMC44ODYyNzQ1
MDk4ABABgALSFBUWF1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiFhhYTlNPYmpl
Y3QIERokKTI3SUxRU1ddZGp3fp2foaaxusLFAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAA
AAAAAAAAAM4=
</data>
<key>Font</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGkCwwVFlUkbnVsbNQNDg8QERIT
FFZOU1NpemVYTlNmRmxhZ3NWTlNOYW1lViRjbGFzcyNALgAAAAAAABAQgAKAA18QFUpl
dEJyYWluc01vbm8tUmVndWxhctIXGBkaWiRjbGFzc25hbWVYJGNsYXNzZXNWTlNGb250
ohkbWE5TT2JqZWN0CBEaJCkyN0lMUVNYXmdud36FjpCSlKyxvMXMzwAAAAAAAAEBAAAA
AAAAABwAAAAAAAAAAAAAAAAAAADY
</data>
<key>FontAntialias</key>
<true/>
<key>FontWidthSpacing</key>
<real>1.004032258064516</real>
<key>ProfileCurrentVersion</key>
<real>2.0699999999999998</real>
<key>SelectionColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAnMC45MDE5NjA3ODQzIDAuNTQ5MDE5NjA3
OCAwLjMyMTU2ODYyNzUAEAGAAtIUFRYXWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xv
cqIWGFhOU09iamVjdAgRGiQpMjdJTFFTV11kand+qKqssbzFzdAAAAAAAAABAQAAAAAA
AAAZAAAAAAAAAAAAAAAAAAAA2Q==
</data>
<key>TextBoldColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAmMC4zMzcyNTQ5MDIgMC40MzUyOTQxMTc2
IDAuNDAzOTIxNTY4NgAQAYAC0hQVFhdaJGNsYXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9y
ohYYWE5TT2JqZWN0CBEaJCkyN0lMUVNXXWRqd36nqauwu8TMzwAAAAAAAAEBAAAAAAAA
ABkAAAAAAAAAAAAAAAAAAADY
</data>
<key>WindowTitle</key>
<string>终端</string>
<key>columnCount</key>
<integer>189</integer>
<key>name</key>
<string>Basic</string>
<key>rowCount</key>
<integer>44</integer>
<key>type</key>
<string>Window Settings</string>
</dict>
</plist>
if &diff
colorscheme desert
endif
"忽略大小写
":set ignorecase
"鼠标提示
"set mouse=a
set showcmd
"自动改变路径
set autochdir
"显示行号
set number
"检测文件的类型
filetype on
"设置当前行
"set cursorline
"记录历史的行数
set history=1000
"自动对齐
set autoindent
set cindent
"智能选择对齐方式
set smartindent
"显示当前路径
set title
"TAB替换为空格
:set ts=4
:set expandtab
set tabstop=4
"是否让tab显示成>.的样式
":set list listchars=tab:>.
"当前行之间交错时使用4个空格
set shiftwidth=4
"设置匹配模式,输入做括号会出现右括号
set showmatch
"编辑时显示光标状态
set ruler
"高亮查找
set hlsearch
"粘贴插入
set paste
"快速匹配
set incsearch
"选择是否自动备份
set nobackup
"set backup
"是否语法高亮
syntax enable
"主题
packadd! dracula
colorscheme dracula
"""""""""""""设置开启ctags"""""""""""""
map <F4> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>
"第一个命令里的分号是必不可少的。这个命令让vim首先在当前目录里寻找tags文件,如果没有找到
set tags=tags;
"""""""""""""""""Taglist设置"""""""""""""""""
"映射vim tlist打开/关闭
map : Tlist
let Tlist_Auto_Open = 1 " 在启动VIM后,自动打开taglist窗口
let Tlist_Ctags_Cmd = '/opt/homebrew/bin/ctags' "设定ctags的位置
let Tlist_Use_Right_Window=0 " 1为让窗口显示在右边,0为显示在左边
let Tlist_Show_One_File=1 "让taglist可以同时展示多个文件的函数列表,设置为1时不同时显示>多个文件的tag,只显示当前文件的
let Tlist_File_Fold_Auto_Close=1 "同时显示多个文件中的tag时,taglist只显示当前文件tag,>其他文件的函数列表折叠隐藏
let Tlist_Exit_OnlyWindow=1 "当taglist是最后一个分割窗口时,自动退出vim
"let Tlist_Use_SingleClick= 1 " 缺省情况下,在双击一个tag时,才会跳到该tag定义的位置
"let Tlist_Process_File_Always=0 "是否一直处理tags.1:处理;0:不处理
"状态栏
":set statusline=%F%m%r%h%w\[FORMAT=%{&ff}\ [TYPE=%Y]\ [POS=%04l,%04v][%p%%]\[TLEN=%L]]
set statusline=%F%m%r%h%w\ [POS=%04l,%04v][%p%%]\[TLEN=%L]]
set laststatus=2
highlight WhitespaceEOL ctermbg=green guibg=red
match WhitespaceEOL /\s\+$/
if &diff
colorscheme pablo
endif
"状态行显示内容
" %f 只显示名字不显示路径
" %F 当前文件名
" %m 当前文件修改状态
" %r 当前文件是否只读
" %Y 当前文件类型
" %{&fileformat} 当前文件编码
" %b 当前光标处字符的 ASCII 码值
" %B 当前光标处字符的十六进制值
" %l 当前光标行号
" %c 当前光标列号
" %V 当前光标虚拟列号 (根据字符所占字节数计算)
" %p 当前行占总行数的百分比
" %% 百分号
" %L 当前文件总行数
" vim中文乱码问题
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
" F12生成此地的tag
"map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .
" nerdtree
let g:NERDTree_title="[NERDTree]"
"let g:winManagerWindowLayout="NERDTree|TagList"
let g:winManagerWindowLayout="NERDTree"
"let NERDTreeWinPos="right"
let g:winManagerWidth = 15
"wm 默认打开
let g:AutoOpenWinManager = 0
"let g:miniBufExplMapWindowNavVim = 1
"let g:miniBufExplMapWindowNavArrows = 1
"let g:miniBufExplMapCTabSwitchBufs = 1
"let g:miniBufExplModSelTarget = 1
"let g:miniBufExplMoreThanOne=0
"打开上次关闭的地方
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif
function! NERDTree_Start()
exec 'NERDTree'
endfunction
function! NERDTree_IsValid()
return 1
endfunction
"wm快捷键
nmap wm :WMToggle<CR>
if has("~/bin/cscope")
set csprg=/home/zhonglun.jiang/bin/cscope
set csto=0
set cst
set nocsverb "如果直接写csverb会出现需要按enter
set cspc=3
"add any database in current dir
if filereadable("cscope.out")
cs add cscope.out
"else search cscope.out elsewhere
else
let cscope_file=findfile("cscope.out", ".;")
let cscope_pre=matchstr(cscope_file, ".*/")
if !empty(cscope_file) && filereadable(cscope_file)
exe "cs add" cscope_file cscope_pre
endif
endif
set csverb
endif
function! AutoLoadCTagsAndCScope()
let max = 20
let dir = './'
let i = 0
let break = 0
while isdirectory(dir) && i < max
if filereadable(dir . 'cscope.out')
execute 'cs add ' . dir . 'cscope.out'
let break = 1
endif
if filereadable(dir . 'tags')
execute 'set tags =' . dir . 'tags'
let break = 1
endif
if break == 1
execute 'lcd ' . dir
break
endif
let dir = dir . '../'
let i = i + 1
endwhile
endf
"nmap <F9> :call AutoLoadCTagsAndCScope()<CR>
nmap <C-\>s :cs find s <C-R>=expand("" )<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("" )<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("" )<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("" )<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("" )<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("" )<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("" )<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("" )<CR><CR>
git config文件修改
[user]
name = allan
email = [email protected]
[diff]
tool = bc3
[difftool "bc3"]
path = /Applications/Beyond Compare.app/Contents/MacOS/bcomp
[alias]
st = status
ss = show --stat --stat-name-width=200 --stat-graph-width=5
co = checkout
cp = cherry-pick
lg = log --graph
cm = commit
br = branch
[pull]
rebase = true
[color]
ui = auto
[commit]
template = /Users/allan/.commit.template
idea插件:
rainbow brackets
key promoter X
dracula theme