简体   繁体   中英

Using the Command-line Command to launch Sublime Text 2 on OS X

I just started reading Michael Hartl's book on Rails and I've run across a problem in the setup phase. Hartl keeps referring to making a file in my home directory, but I'm not quite sure how to do this. For example, when I try to setup the command line for sublime text the instructions tell me to do this: Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

My problem is that I don't know how to put a ~/bin directory in my path. I know this is real basic but any help would be greatly appreciation.

create or edit ~/.profile (works with both bash and zsh)

add the following

export PATH=$PATH:$HOME/bin

The line above is saying, overwrite the PATH environment variable and set it to the previous path plus ~/bin

Now when you try to run a command, bash will look in all the colon separated paths in your PATH environment variable for an executable.

To see your entire PATH , type echo $PATH in a terminal. Or better yet, type env to see all environment variables.

On your terminal

$ mkdir ~/bin
$ sudo ln -s "/Applications/Sublime Text2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl

Edit ~/.base_profile

export PATH=$PATH:~/bin

usage:

open current directory:

subl .

在你的~/.bashrc文件中添加到结尾:

 PATH="$HOME/bin:$PATH"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM