I've been having trouble modifying my path to add Sublime Text 2. I've added a ~/bin
directory and run this command:
我一直在修改我的路径以添加崇高的文本2。我添加了一个~/bin目录并运行这个命令:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
The subl link appears in ~/bin
. But I need to add the ~/bin
directory to my path. I'm fairly new at this, and I don't know where my path is. I've looked around, and found that the likely files are either .profile
, .bash_profile
or .bashrc
subl链接出现在~/bin中。但是我需要将~/bin目录添加到路径中。我是新手,我不知道我的路在哪里。我查看了一下,发现可能的文件是.profile、.bash_profile或.bashrc。
I don't have a .bash_profile
. To .profile
and .bashrc
I added
我没有。bash_profile。我添加了.profile和.bashrc。
PATH=$PATH:~/bin/subl
export PATH
Is that the right thing to add? And if so, where should I add it?
这是正确的补充吗?如果是的话,我应该把它加到哪里?
When I echo $PATH
, I get:
当我返回$PATH时,我得到:
/Users/<username>/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/bin:/Users/<username>/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/<username>/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/<username>/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
When I type subl
, I get:
当我输入subl时,我得到:
-bash: subl: command not found
Thanks!
谢谢!
p.s. I had previously installed Macports, which modified my .profile
file. Not sure if this has anything to do with it - I now don't know what the default .profile
looks like.
我之前安装了Macports,它修改了我的.profile文件。不确定这是否与它有关——我现在不知道默认的.profile是什么样子的。
13 个解决方案
#1
84
I was just as new to this as you, which means I wasn't even sure how to read half the stuff related to modifying PATH. Eventually though I came upon a way to do it that doesn't require you to put subl into the .rvm/bin (since that is for something else) but in its appropriate directory, which is ~/bin.
我和你一样是新手,这意味着我甚至不知道如何阅读与修改路径相关的一半内容。最后,尽管我找到了一种方法,但它并不要求您将subl放入.rvm/bin(因为这是为了其他的东西),但是在它的适当的目录中,它是~/bin。
Go to your terminal and type:
到你的终端和类型:
open -a Finder /usr/bin
This will open your Finder to the /usr/bin directory. Once you're there open a new Finder, go to Applications, right click on the Sublime Text icon and go to Show Package Contents, then to Contents, SharedSupport, bin. Copy the subl file and paste it into the other Finder showing /usr/bin
这将打开您的Finder到/usr/bin目录。一旦你打开了一个新的Finder,进入应用程序,右键点击这个崇高的文本图标,然后去显示包的内容,然后是内容,SharedSupport, bin。复制subl文件并将其粘贴到另一个Finder中显示/usr/bin。
That's it! You should be set to use the command:
就是这样!您应该使用以下命令:
subl . (or subl file.name)
#2
43
Instread of all commented here. You need add symlink to sublime in /usr/local/bin
. Its not require a root access. And don't need to create another bin directory.
所有评论都在这里。您需要在/ usr/local/bin中添加symlink到崇高。它不需要根访问。并且不需要创建另一个bin目录。
For Sublime Text 2
崇高的文本2
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/
For Sublime Text 3
崇高的文本3
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/
#3
35
Update for zsh For some reason, "~/bin" in my path wasn't working when I recently switched from bash to zsh/prezto. I changed it to "/Users/myusername/bin" and it works fine once again. I'll be looking for a reason why and update when I find it. Please comment if you have a better solution.
由于某些原因更新zsh,当我最近从bash切换到zsh/prezto时,在我的路径中“~/bin”不工作。我将它改为“/用户/myusername/bin”,它再次运行良好。我将寻找一个原因,为什么和更新当我找到它。如果你有更好的解决方案,请评论。
I know this is an old post, but thought I'd document a solution for anyone else trying to follow the instructions given by sublimetext for working with sublime from the OSX command line verbatim. Update for Sublime text 3 Sublime Text 3 Documentation
我知道这是一个古老的帖子,但是我想我应该为其他人提供一个解决方案,让他们能够按照sublimetext的指示,逐字逐句地从OSX命令行中进行工作。更新崇高的文本3卓越的文本3文件。
1) Create a directory called "bin" in your home directory "~/"
1)在您的主目录“~/”中创建一个名为“bin”的目录。
mkdir ~/bin
2) Create a symbolic link to your sublime text 2 app in the new directory you just created
2)在刚刚创建的新目录中创建一个与您的卓越文本2应用程序的符号链接。
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Update for Sublime Text 3 app path is slightly different:
高级文本3应用路径的更新略有不同:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
3) Follow Ryan Hoffman's instructions on how to easily add to the path in OSX: add to the path on Mac OSX Add the newly created "~/bin" to the path using his technique. Your /etc/paths file will look something like this when you're done (notice ~/bin at the end):
3)跟随Ryan Hoffman关于如何轻松添加到OSX中的路径的说明:添加到Mac OSX上的路径,使用他的技术将新创建的“~/bin”添加到路径中。您的/etc/path文件在您完成时将会是这样的(请注意:结尾的~/bin):
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
~/bin
4) Open a new terminal window to start using subl from the command line.
4)打开一个新的终端窗口,从命令行开始使用subl。
#4
11
You don't need to do PATH=$PATH:~/bin/subl
. Instead, PATH=$PATH:~/bin
is sufficient. That way, you are telling the shell to look into ~/bin
for binaries. With your command, you told the shell to look into the "folder" ~/bin/subl
for binaries, which doesn't work. Furthermore, you don't need to add the commands in two files. Add them once in your .bashrc
. I am not a bash
expert, but I can recommend reading this blog post for further explanations of the different startup files.
您不需要做PATH=$PATH:~/bin/subl。相反,= $ PATH:~ /本就足够了。这样,您就可以让shell查看二进制文件的~/bin。在您的命令下,您告诉shell查看“文件夹”~/bin/subl用于二进制文件,这是无效的。此外,您不需要在两个文件中添加命令。将它们添加到.bashrc中。我不是bash专家,但我可以推荐阅读这篇博文,以进一步解释不同的启动文件。
#5
6
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
博士tl;
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.
在Yosemite (OS X 10.10)中,我遇到了同样的问题,在新安装的OS中,~/bin目录不存在,也不在您的路径中。然而,在你的道路上已经有许多有用的地方,你可以把它与崇高联系起来。
For example here are the items currently in my path (use $ echo $PATH
to get a list):
例如,这里是当前路径中的项目(使用$ echo $路径获取列表):
/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
您可以很容易地修改该脚本,以便在您的路径中使用已经在您的路径中使用的位置,该位置将更改为~/bin/subl到/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
#6
3
You need to first create a symbolic link to /usr/bin
. A symbolic link - or SymLink - is an alias or shortcut to a directory. Do as follow:
您需要首先创建一个符号链接到/usr/bin。符号链接-或符号链接-是一个目录的别名或快捷方式。做:
-
First, make sure you are in your Home directory using the Terminal command line
首先,确保使用终端命令行在您的主目录中。
cd ~
cd ~
-
Create a symbolic link to your
usr/bin
directory.创建一个指向usr/bin目录的符号链接。
ln -s /usr/bin bin
ln - s工作本
Where
ln
= create a link,-s
= symbolic, followed by the[target diectory]
and[name of link]
其中ln =创建一个链接,-s =符号,后面是[目标diectory]和[链接名称]
-
Test your new link
测试你的新链接
cd bin
cd本
This should take you to your
~/bin
- same as/usr/bin
. The~
indicates there's a long path hidden inside.这应该带你到你的~/bin -和/usr/bin。~表示有一条很长的路隐藏在里面。
-
Now, go back to your Home folder to install the
subl
command现在,回到您的主文件夹来安装subl命令。
cd ~
cd ~
-
Install the Sublime Text 2 command line tool. I'll be using
sudo
to bypass any permission blocks.安装崇高的文本2命令行工具。我将使用sudo绕过任何权限块。
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
sudo ln -s "/ application /Sublime Text 2。应用程序/内容/ SharedSupport / bin / ~ / bin / subl subl”
You should be good to go! Test it by simply entering
subl
as your command line and it should launch Sublime Text 2 from Terminal.你该走了!通过简单地输入subl作为你的命令行来测试它,它应该从终端发射崇高的文本2。
#7
2
had the same challenge and ended up just creating a .bash_profile file, and adding the path statement directly there. Worked without incident. You may want to also check out Alvin Alexander's sample .bash_profile post (http://alvinalexander.com/blog/post/mac-os-x/sample-mac-osx-bashrc-terminal-startup-file) - I found a couple of other helpful commands that I'll be adding as well.
有相同的挑战,最后只创建一个.bash_profile文件,并在那里直接添加路径语句。工作没有事件。您可能还需要查看Alvin Alexander的样例。bash_profile post (http://alvinalexander.com/blog/post/mac-os-x/sample-mac-osx-bashrc- end -startup-file)——我还会添加一些其他有用的命令。
#8
2
Simple do it this on the terminal:
简单在终端上做这个:
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
That is where my Sublime is stored, try to type the path to Sublime because your version may differ.
这就是我的崇高之处,试着为崇高而努力,因为你的版本可能不同。
subl .
Should be working fine.
应工作正常。
#9
1
I had been struggling with this problem recently. I realized that the ~
isn't expanded to your home directory in the path. At least it wasn't for me.
我最近一直在和这个问题做斗争。我意识到~并没有扩展到路径中的主目录。至少对我来说不是这样的。
This is what I did to make it work.
这就是我所做的。
export PATH=$PATH:$HOME/bin
My subl
was linked from the application directory into my ~/bin
per some followup instructions I found for brew cask. Unfortunately the path was never updated.
我的subl从应用程序目录链接到我的~/bin中,根据我在brew cask中找到的一些后续指令。不幸的是,这条路从来没有更新过。
#10
1
Here are the full instructions to do this (for Sublime Text 3):
下面是完成这一任务的完整说明(对于崇高的文本3):
-
Please check your System Integrity Protection status by the following command:
请通过以下命令检查您的系统完整性保护状态:
$ csrutil status
If it's enabled, please follow these steps:
如果启用了,请遵循以下步骤:
-
Boot to the Recovery OS of OS X by restarting your machine and holding down Command + R at startup.
重启你的机器并在启动时按住Command + R,启动OS X的恢复操作系统。
-
Launch Terminal from the Utilities menu.
从实用程序菜单中启动终端。
-
Run the following command:
运行以下命令:
$ csrutil disable $ reboot
This is due to a security feature of OS X called System Integrity Protection, which will protect against unauthorised access to system locations and processes. So if this feature is enabled, you won't be able to modify the content of /usr/bin.
这是由于OS X的安全特性,称为系统完整性保护,它将防止未经授权的访问系统位置和进程。因此,如果启用了这个特性,您将无法修改/usr/bin的内容。
-
-
Create a symlink from /usr/bin to ~/bin:
从/usr/bin到~/bin创建一个符号链接:
$ sudo ln -s /usr/bin ~/bin
-
Create a symlink from the Sublime Text 3 CLI tool to ~/bin:
从卓越的文本3 CLI工具创建一个符号链接到~/bin:
$ sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/bin
-
Test it.
测试它。
$ subl .
#11
1
echo $PATH
and use one of the path already in there. In this example "/usr/local/bin"
使用其中一条路径。在这个例子中“/ usr /地方/ bin”
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
if the system return No such file or directory
如果系统没有返回该文件或目录。
sudo mkdir /usr/local/bin/
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
test if it's working
测试工作
subl
This is for Sublime Text 3.
这是关于崇高的文本3。
#12
0
following works with me. I have Sublime version 3 and posting it here if someone is looking for help:
后和我一起工作。我有一个崇高的版本3,如果有人寻求帮助,我将它张贴在这里:
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /bin/subl
#13
0
It seems like in Yosemite the command is actually for Sublime 3, but I may be mistaken:
在约塞米蒂看来,这个命令实际上是为了崇高,但我可能错了:
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/
#1
84
I was just as new to this as you, which means I wasn't even sure how to read half the stuff related to modifying PATH. Eventually though I came upon a way to do it that doesn't require you to put subl into the .rvm/bin (since that is for something else) but in its appropriate directory, which is ~/bin.
我和你一样是新手,这意味着我甚至不知道如何阅读与修改路径相关的一半内容。最后,尽管我找到了一种方法,但它并不要求您将subl放入.rvm/bin(因为这是为了其他的东西),但是在它的适当的目录中,它是~/bin。
Go to your terminal and type:
到你的终端和类型:
open -a Finder /usr/bin
This will open your Finder to the /usr/bin directory. Once you're there open a new Finder, go to Applications, right click on the Sublime Text icon and go to Show Package Contents, then to Contents, SharedSupport, bin. Copy the subl file and paste it into the other Finder showing /usr/bin
这将打开您的Finder到/usr/bin目录。一旦你打开了一个新的Finder,进入应用程序,右键点击这个崇高的文本图标,然后去显示包的内容,然后是内容,SharedSupport, bin。复制subl文件并将其粘贴到另一个Finder中显示/usr/bin。
That's it! You should be set to use the command:
就是这样!您应该使用以下命令:
subl . (or subl file.name)
#2
43
Instread of all commented here. You need add symlink to sublime in /usr/local/bin
. Its not require a root access. And don't need to create another bin directory.
所有评论都在这里。您需要在/ usr/local/bin中添加symlink到崇高。它不需要根访问。并且不需要创建另一个bin目录。
For Sublime Text 2
崇高的文本2
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/
For Sublime Text 3
崇高的文本3
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/
#3
35
Update for zsh For some reason, "~/bin" in my path wasn't working when I recently switched from bash to zsh/prezto. I changed it to "/Users/myusername/bin" and it works fine once again. I'll be looking for a reason why and update when I find it. Please comment if you have a better solution.
由于某些原因更新zsh,当我最近从bash切换到zsh/prezto时,在我的路径中“~/bin”不工作。我将它改为“/用户/myusername/bin”,它再次运行良好。我将寻找一个原因,为什么和更新当我找到它。如果你有更好的解决方案,请评论。
I know this is an old post, but thought I'd document a solution for anyone else trying to follow the instructions given by sublimetext for working with sublime from the OSX command line verbatim. Update for Sublime text 3 Sublime Text 3 Documentation
我知道这是一个古老的帖子,但是我想我应该为其他人提供一个解决方案,让他们能够按照sublimetext的指示,逐字逐句地从OSX命令行中进行工作。更新崇高的文本3卓越的文本3文件。
1) Create a directory called "bin" in your home directory "~/"
1)在您的主目录“~/”中创建一个名为“bin”的目录。
mkdir ~/bin
2) Create a symbolic link to your sublime text 2 app in the new directory you just created
2)在刚刚创建的新目录中创建一个与您的卓越文本2应用程序的符号链接。
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Update for Sublime Text 3 app path is slightly different:
高级文本3应用路径的更新略有不同:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
3) Follow Ryan Hoffman's instructions on how to easily add to the path in OSX: add to the path on Mac OSX Add the newly created "~/bin" to the path using his technique. Your /etc/paths file will look something like this when you're done (notice ~/bin at the end):
3)跟随Ryan Hoffman关于如何轻松添加到OSX中的路径的说明:添加到Mac OSX上的路径,使用他的技术将新创建的“~/bin”添加到路径中。您的/etc/path文件在您完成时将会是这样的(请注意:结尾的~/bin):
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
~/bin
4) Open a new terminal window to start using subl from the command line.
4)打开一个新的终端窗口,从命令行开始使用subl。
#4
11
You don't need to do PATH=$PATH:~/bin/subl
. Instead, PATH=$PATH:~/bin
is sufficient. That way, you are telling the shell to look into ~/bin
for binaries. With your command, you told the shell to look into the "folder" ~/bin/subl
for binaries, which doesn't work. Furthermore, you don't need to add the commands in two files. Add them once in your .bashrc
. I am not a bash
expert, but I can recommend reading this blog post for further explanations of the different startup files.
您不需要做PATH=$PATH:~/bin/subl。相反,= $ PATH:~ /本就足够了。这样,您就可以让shell查看二进制文件的~/bin。在您的命令下,您告诉shell查看“文件夹”~/bin/subl用于二进制文件,这是无效的。此外,您不需要在两个文件中添加命令。将它们添加到.bashrc中。我不是bash专家,但我可以推荐阅读这篇博文,以进一步解释不同的启动文件。
#5
6
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
博士tl;
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.
在Yosemite (OS X 10.10)中,我遇到了同样的问题,在新安装的OS中,~/bin目录不存在,也不在您的路径中。然而,在你的道路上已经有许多有用的地方,你可以把它与崇高联系起来。
For example here are the items currently in my path (use $ echo $PATH
to get a list):
例如,这里是当前路径中的项目(使用$ echo $路径获取列表):
/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
您可以很容易地修改该脚本,以便在您的路径中使用已经在您的路径中使用的位置,该位置将更改为~/bin/subl到/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
#6
3
You need to first create a symbolic link to /usr/bin
. A symbolic link - or SymLink - is an alias or shortcut to a directory. Do as follow:
您需要首先创建一个符号链接到/usr/bin。符号链接-或符号链接-是一个目录的别名或快捷方式。做:
-
First, make sure you are in your Home directory using the Terminal command line
首先,确保使用终端命令行在您的主目录中。
cd ~
cd ~
-
Create a symbolic link to your
usr/bin
directory.创建一个指向usr/bin目录的符号链接。
ln -s /usr/bin bin
ln - s工作本
Where
ln
= create a link,-s
= symbolic, followed by the[target diectory]
and[name of link]
其中ln =创建一个链接,-s =符号,后面是[目标diectory]和[链接名称]
-
Test your new link
测试你的新链接
cd bin
cd本
This should take you to your
~/bin
- same as/usr/bin
. The~
indicates there's a long path hidden inside.这应该带你到你的~/bin -和/usr/bin。~表示有一条很长的路隐藏在里面。
-
Now, go back to your Home folder to install the
subl
command现在,回到您的主文件夹来安装subl命令。
cd ~
cd ~
-
Install the Sublime Text 2 command line tool. I'll be using
sudo
to bypass any permission blocks.安装崇高的文本2命令行工具。我将使用sudo绕过任何权限块。
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
sudo ln -s "/ application /Sublime Text 2。应用程序/内容/ SharedSupport / bin / ~ / bin / subl subl”
You should be good to go! Test it by simply entering
subl
as your command line and it should launch Sublime Text 2 from Terminal.你该走了!通过简单地输入subl作为你的命令行来测试它,它应该从终端发射崇高的文本2。
#7
2
had the same challenge and ended up just creating a .bash_profile file, and adding the path statement directly there. Worked without incident. You may want to also check out Alvin Alexander's sample .bash_profile post (http://alvinalexander.com/blog/post/mac-os-x/sample-mac-osx-bashrc-terminal-startup-file) - I found a couple of other helpful commands that I'll be adding as well.
有相同的挑战,最后只创建一个.bash_profile文件,并在那里直接添加路径语句。工作没有事件。您可能还需要查看Alvin Alexander的样例。bash_profile post (http://alvinalexander.com/blog/post/mac-os-x/sample-mac-osx-bashrc- end -startup-file)——我还会添加一些其他有用的命令。
#8
2
Simple do it this on the terminal:
简单在终端上做这个:
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
That is where my Sublime is stored, try to type the path to Sublime because your version may differ.
这就是我的崇高之处,试着为崇高而努力,因为你的版本可能不同。
subl .
Should be working fine.
应工作正常。
#9
1
I had been struggling with this problem recently. I realized that the ~
isn't expanded to your home directory in the path. At least it wasn't for me.
我最近一直在和这个问题做斗争。我意识到~并没有扩展到路径中的主目录。至少对我来说不是这样的。
This is what I did to make it work.
这就是我所做的。
export PATH=$PATH:$HOME/bin
My subl
was linked from the application directory into my ~/bin
per some followup instructions I found for brew cask. Unfortunately the path was never updated.
我的subl从应用程序目录链接到我的~/bin中,根据我在brew cask中找到的一些后续指令。不幸的是,这条路从来没有更新过。
#10
1
Here are the full instructions to do this (for Sublime Text 3):
下面是完成这一任务的完整说明(对于崇高的文本3):
-
Please check your System Integrity Protection status by the following command:
请通过以下命令检查您的系统完整性保护状态:
$ csrutil status
If it's enabled, please follow these steps:
如果启用了,请遵循以下步骤:
-
Boot to the Recovery OS of OS X by restarting your machine and holding down Command + R at startup.
重启你的机器并在启动时按住Command + R,启动OS X的恢复操作系统。
-
Launch Terminal from the Utilities menu.
从实用程序菜单中启动终端。
-
Run the following command:
运行以下命令:
$ csrutil disable $ reboot
This is due to a security feature of OS X called System Integrity Protection, which will protect against unauthorised access to system locations and processes. So if this feature is enabled, you won't be able to modify the content of /usr/bin.
这是由于OS X的安全特性,称为系统完整性保护,它将防止未经授权的访问系统位置和进程。因此,如果启用了这个特性,您将无法修改/usr/bin的内容。
-
-
Create a symlink from /usr/bin to ~/bin:
从/usr/bin到~/bin创建一个符号链接:
$ sudo ln -s /usr/bin ~/bin
-
Create a symlink from the Sublime Text 3 CLI tool to ~/bin:
从卓越的文本3 CLI工具创建一个符号链接到~/bin:
$ sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/bin
-
Test it.
测试它。
$ subl .
#11
1
echo $PATH
and use one of the path already in there. In this example "/usr/local/bin"
使用其中一条路径。在这个例子中“/ usr /地方/ bin”
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
if the system return No such file or directory
如果系统没有返回该文件或目录。
sudo mkdir /usr/local/bin/
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
test if it's working
测试工作
subl
This is for Sublime Text 3.
这是关于崇高的文本3。
#12
0
following works with me. I have Sublime version 3 and posting it here if someone is looking for help:
后和我一起工作。我有一个崇高的版本3,如果有人寻求帮助,我将它张贴在这里:
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /bin/subl
#13
0
It seems like in Yosemite the command is actually for Sublime 3, but I may be mistaken:
在约塞米蒂看来,这个命令实际上是为了崇高,但我可能错了:
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/