Mac中使用Terminal启动Sublime Text 2
2013-12-13 10:23
519 查看
Installation
The official documentation I linked to above recommends creating a ~/bin folder (in your home directory). That's weird, I don't recall ever being asked to do that on OS X since most people install binaries within/usr/local/binwhich – if you're a developer – is likely to already have tons of other binaries.
So contrary to the Sublime team recommendation, we're not going to create a
binfolder in your home directory:
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime
This will simply create a symlink called
sublime(remember, we like names that don't suck to type 500 times a day) between the
sublbinary stashed in the Sublime application package, and a folder where your system usually looks for binaries to execute (launch). Think of it as a wormhole of awesome.
Now let's do a check to see if everything will run smoothly. Enter this:
open ~/.bash_profile
(In some cases the profile file is named ~/.profile)
You should see at the top of the file a line that starts with:
export PATH=
This contains all the directories that will be looked into for executable binaries when you type a command in Terminal. Since we create a symlink to
sublcalled
sublimein the
/usr/local/bindirectory let's check if this directory is listed on that same line.
If it is, perfect. Let's keep going. If not, simply add it like this and save the file:
export PATH=/usr/local/bin:(...)
Note: The '(...)' in this example represents other folders that would be listed on the same line and separated by a colon.
If you don't already have a PATH set in your bash_profile you can type:
export PATH=/usr/local/bin:$PATH
If you had to add
/usr/local/binto your PATH, run the following command before continuing:
source ~/.bash_profile
This will reload your
.bash_profilewith the newly added directory.
Testing
Open a Terminal window and run:sublime filename(replace "filename" by an actual file name)
or
sublime foldername(replace "foldername" by an actual folder name)
or even
sublime .(to open the entire current directory)
Conclusion
Now you don't need to get out of Terminal to simply open a file or a folder, you didn't have to add an "alias" or yet another bin directory to your.bash_profilewhich you would have needed with the official instructions given by the Sublime team.
Have fun, Sublime is a great editor showing a lot of promise.
相关文章推荐
- mac下修改默认的terminal启动
- mac 终端(terminal) 启动tomcat
- Mac OS X Terminal 101:终端使用初级教程
- Mac下Sublime Text 2使用心得
- 使用iTerm2替代Mac自带Terminal终端
- Mac OS X Terminal 101:终端使用初级教程
- Mac系统 Terminal终端功能使用方法
- 如何在Mac terminal中使用GUI Emacs打开文件
- sublime Text3 在Mac上使用Home和End键跳到行首和行尾
- Spring Boot项目在Mac下使用Maven启动时碰到的神奇问题:Unregistering JMX-exposed beans on shutdown
- mac下使用terminal open命令打开文件(PDF)
- mac下在命令行使用sublime text
- Mac OS X Terminal 101:终端使用初级教程
- Mac下Sublime Text 2使用心得
- mac系统下安装tomcat,并启动。ideaIU工具的使用
- MAC下使用terminal连接到Parallel创建的Linux虚拟机
- Mac OS X Terminal 101:终端使用初级教程
- Terminal:Mac使用终端操作数据库
- Mac 使用Sublime Text 3 搭建C开发环境
- MAC 系统如何使用 Sublime Text 2 直接编译运行 java 代码