1. 添加环境变量
vi ~/.bash_profile
export PATH=selfdefine_path:$PATH
source ~/.bash_profile
适用于安装Application之后将该Application的Contents/bin下的可执行程序添加到环境变量,使得在终端能够启用。
例如使用cmake-3.25.0-macos-universal.dmg
安装好cmake之后将该Application的Contents/bin下的可执行程序添加到环境变量,使得在终端能够启用。
2. 改变终端颜色
vim ~/.bash_profile
export CLICOLOR=1
export LSCOLORS=ExGxFxdaCxDaDahbadeche
source ~/.bash_profile
参考:
https://zhuanlan.zhihu.com/p/60880207
3. 改变vim颜色
vi ~/.vimrc
1 " Configuration file for vim
2 set modelines=0 " CVE-2007-2438
3
4 " Normally we use vim-extensions. If you want true vi-compatibility
5 " remove change the following statements
6 set nocompatible " Use Vim defaults instead of 100% vi compatibility
7 set backspace=2 " more powerful backspacing
8
9 " Don't write backup file if vim is being called by "crontab -e"
10 au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
11 " Don't write backup file if vim is being called by "chpass"
12 au BufWrite /private/etc/pw.* set nowritebackup nobackup
13
14 let skip_defaults_vim=1
15
16 " 自定义设置
17 filetype on
18 syntax on
19 set number
20 set cindent
21 set smartindent
22 set showmatch
23 set ruler
24 set cursorline
25 set autoindent
26 set cindent
27 set tabstop=4
28 set shiftwidth=4
29 set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\
30 set hlsearch
4. Terminal快捷键
Command + K 清屏
Command + T 新建标签
Command +W 关闭当前标签页
Command + S 保存终端输出
Command + D 垂直分隔当前标签页
Command + Shift + D 水平分隔当前标签页
Command + shift + {或} 向左/向右切换标签
5. cmake -G Xcode ..
报错提示未找到编译器
cmake指定Xcode为generator时报错:
lg@lgdeMacBook-Pro build % cmake -G Xcode ..
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:22 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:22 (project):
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!
See also "/Users/lg/01.Tools/01.PanGu/build/CMakeFiles/CMakeOutput.log".
See also "/Users/lg/01.Tools/01.PanGu/build/CMakeFiles/CMakeError.log".
原因是在命令行中xcode-select指向的是/Library/Developer/CommandLineTools
,生成xcode项目时,需要将xcode-select指向/Applications/Xcode.app/Contents/Developer
解决方法:
终端上执行:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
参考:CMake生成Xcode失败 No CMAKE_C_COMPILER could be found