博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Mac中使用Terminal启动Sublime Text 2
阅读量:5916 次
发布时间:2019-06-19

本文共 2436 字,大约阅读时间需要 8 分钟。

hot3.png

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/bin which – 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 bin folder in your home directory:

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

This will simply create a  called sublime (remember, we like names that don't suck to type 500 times a day) between the subl binary 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 subl called sublime in the /usr/local/bin directory 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/bin to your PATH, run the following command before continuing:

source ~/.bash_profile

This will reload your .bash_profile with 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_profile which 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.

转载于:https://my.oschina.net/H7QMCSeOLOxu/blog/184108

你可能感兴趣的文章
亲们,不用再创建变更了
查看>>
微软Windows主管:WP今年不是我们的重点
查看>>
纯科普篇!安全防盗电子围栏这些事儿
查看>>
百会CRM:大数据和云计算引爆智能化变革
查看>>
智能PDU怎样帮助数据中心节能
查看>>
走向5G时代功在技术之外
查看>>
JAVA之抽象类与接口的区别
查看>>
2021年3GPP物联网标准将占蜂窝物联网无线节点出货量一半以上
查看>>
【云和恩墨大讲堂电子期刊】挑战者:Google成功的背后
查看>>
Oracle 12c的一些新等待事件
查看>>
微博已跨过“历史三峡”?
查看>>
加拿大三分之二的电力供应来自可再生能源
查看>>
AngularJS —— 使用模块组织你的代码 【已翻译100%】(2/3)
查看>>
android.support.v7.widget.SwitchCompat
查看>>
白话composer的简单使用
查看>>
SPI机制与策略模式
查看>>
使用 Docker 和 Traefik 搭建 GitLab (前篇)
查看>>
如何让mysql索引更快一点
查看>>
免费logo创建器launchaco
查看>>
从拥挤的兔子到伪随机数算法
查看>>