Mac Yosemite上安装macvim和YouCompleteMe
2024-09-03 04:44:32
今天在macvim上安装YouCompleteMe的时候,碰到一个运行vim崩溃的错误.查了半天终于解决!
先上一下安装macvim的过程
# install xcode and command line tools
$ xcode-select --install
# install homebrew
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install python
$ brew install python
# install macvim
$ brew install macvim
然后编辑.vimrc
set nocompatible " be iMproved, required
filetype off " required " set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here') " let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim' Plugin 'altercation/vim-colors-solarized'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/syntastic'
Plugin 'Valloric/YouCompleteMe' " All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
在vim中运行命令
:BundleInstall
完成后进入目录中
cd ~/.vim/bundle/YouCompleteMe
./install.sh --clang-completer
编译完成后,运行vim结果出错.
$ vim
Vim: Caught deadly signal ABRT
Vim: Finished.
Abort trap:
查了一圈发现,加一个参数后能正常工作
$ DYLD_FORCE_FLAT_NAMESPACE= vim
但毕竟这不是一个办法,最后在github上的issue页面上看到问题的解决办法:
brew unlink python
运行后依然无效!!!!崩溃!!!
然后继续看下去
$ otool -L /usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/MacOS/Vim | grep -i python
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7., current version 2.7.)
而我的系统上默认的python是2.7.9,而且路径为/Library/Frameworks/Python.framework/Versions/2.7/python!
OK找到问题所在了,现在的任务就是需要把这两个Python的版本调整成为一致!!!!
HOW to do it? Google之找到办法,把所有的操作整理到一起给大家:
sudo rm -R /System/Library/Frameworks/Python.framework/Versions/2.7
sudo mv /Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions
sudo chown -R root:wheel /System/Library/Frameworks/Python.framework/Versions/2.7
sudo rm /System/Library/Frameworks/Python.framework/Versions/Current
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7 /System/Library/Frameworks/Python.framework/Versions/Current
sudo rm /usr/bin/pydoc
sudo rm /usr/bin/python
sudo rm /usr/bin/pythonw
sudo rm /usr/bin/python-config
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc /usr/bin/pydoc
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /usr/bin/python
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw /usr/bin/pythonw
sudo ln -s /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config /usr/bin/python-config
需要详细解释的童鞋,可以查看这篇文档.
执行这段shell之后,需要编辑~/.bash_profile将系统默认的Python路径指向/System/Library这个文件夹
# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/System/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
改变Python版本后,执行vim就不再出现段错误了.
参考文献:
2. installing-homebrew-macvim-with-youcompleteme-on-yosemite
3. Installing / Updating Python on OS X
最新文章
- 通过python将图片生成字符画
- JAVA中关于并发的一些理解
- zend studion实现自动换行
- loj 1046(bfs)
- 在Linux 5/6上使用UDEV SCSI规则配置ASM DISK
- 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。
- POJ 3321 Apple Tree(后根遍历将树转化成序列,用树状数组维护)
- eclipse 中创建maven web项目
- SqlServer 自动备份、自动删除7天前备份
- SQL Server2005使用CTE实现递归
- webdynpro 下拉列表控件
- OpenGL的状态机理解
- 原声js 五子棋 源码
- Java数据结构和算法(二)——数组
- ORACLE环境变量设置
- 关于java中的值传递与引用传递遇到的问题
- Flask Vue.js全栈开发
- CentOS 7 部署 Spring Boot
- webpack学习笔记--配置总结
- webstorm ps
热门文章
- c# 简单又好用的四舍五入方法
- 前端工业化工具Grunt初体验
- SDK里报错[NSConcreteMutableData wbsdk_base64EncodedString]
- mysql备份与还原,增量备份;使用ibd和frm文件恢复数据
- JAVA HDFS API Client 连接HA
- 你以为border-radius只是圆角吗?【各种角度】
- 数据结构之---C语言实现线索二叉树
- LinkedIn架构这十年
- C#中使用正则
- IM开发基础知识补课(四):正确理解HTTP短连接中的Cookie、Session和Token