How do I add ~/bin to my path?

前端 未结 13 984
太阳男子
太阳男子 2020-12-22 19:30

I\'ve been having trouble modifying my path to add Sublime Text 2. I\'ve added a ~/bin directory and run this command:

ln -s \"/Applications/Sub         


        
13条回答
  •  悲&欢浪女
    2020-12-22 19:35

    I'd like to pose an alternate solution to this problem. Use a directory already in your path. Like this:

    $ sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
    

    tl;dr

    I ran into the same problem in Yosemite (OS X 10.10) where, in a fresh install of the OS, the ~/bin directory doesn't exist and isn't in your path. Yet there are lots of useful places already in your path you could place the symlink to Sublime.

    For example here are the items currently in my path (use $ echo $PATH to get a list):

    /Applications/Postgres.app/Contents/Versions/9.3/bin
    /usr/local/bin
    /usr/bin
    /bin
    /usr/sbin
    /sbin:/usr/local/bin
    /usr/local/mysql/bin
    

    You can easily modify the script to use a location already in your path by changing the part that says ~/bin/subl to /usr/local/bin/subl

    Thus, running the following command will accomplish your goal.

    $ sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
    

提交回复
热议问题