~ / bin을 내 경로에 어떻게 추가합니까?
Sublime Text 2를 추가하기 위해 경로를 수정하는 데 문제가있었습니다. ~/bin
디렉토리를 추가하고 다음 명령을 실행했습니다 .
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
하위 링크는에 나타납니다 ~/bin
. 하지만 ~/bin
내 경로에 디렉토리 를 추가해야 합니다. 나는 이것에 상당히 새롭고 내 길이 어디인지 모릅니다. 주변을 둘러 본 결과 가능성이 높은 파일이 .profile
, .bash_profile
또는.bashrc
나는 .bash_profile
. 에 .profile
그리고 .bashrc
나는 추가했다
PATH=$PATH:~/bin/subl
export PATH
추가하는 것이 옳은가요? 그렇다면 어디에 추가해야합니까?
언제 echo $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
를 입력 subl
하면 다음과 같은 결과가 나타납니다.
-bash: subl: command not found
감사!
추신 이전에 Macports를 설치하여 .profile
파일 을 수정했습니다 . 이것이 그것과 관련이 있는지 확실하지 않습니다. 이제 기본값 .profile
이 어떻게 생겼는지 모르겠습니다 .
나는 당신만큼이나 이것에 익숙하지 않았기 때문에 PATH 수정과 관련된 내용의 절반을 읽는 방법도 확신하지 못했습니다. 결국 나는 subl을 .rvm / bin (다른 것을위한 것이기 때문에)에 넣을 필요가 없지만 적절한 디렉토리 인 ~ / bin에 넣을 필요가없는 방법을 찾았습니다.
터미널로 이동하여 다음을 입력하십시오.
open -a Finder /usr/bin
그러면 Finder가 / usr / bin 디렉토리로 열립니다. 새 파인더가 열리면 응용 프로그램으로 이동하여 Sublime Text 아이콘을 마우스 오른쪽 버튼으로 클릭하고 패키지 내용 표시로 이동 한 다음 내용, SharedSupport, bin으로 이동합니다. subl 파일을 복사하여 / usr / bin을 표시하는 다른 Finder에 붙여 넣습니다.
그게 다야! 다음 명령을 사용하도록 설정해야합니다.
subl . (or subl file.name)
여기에 언급 된 모든 내용을 포함합니다. .NET에서 숭고한 심볼릭 링크를 추가해야합니다 /usr/local/bin
. 루트 액세스가 필요하지 않습니다. 그리고 다른 bin 디렉토리를 만들 필요가 없습니다.
숭고한 텍스트 2
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/
숭고한 텍스트 3
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/
zsh 업데이트 어떤 이유로 최근에 bash에서 zsh / prezto로 전환했을 때 내 경로의 "~ / bin"이 작동하지 않았습니다. 나는 그것을 "/ Users / myusername / bin"으로 변경했고 다시 한번 잘 작동합니다. 이유를 찾고 발견하면 업데이트하겠습니다. 더 나은 솔루션이 있으면 의견을 말하십시오.
나는 이것이 오래된 게시물이라는 것을 알고 있지만 OSX 명령 줄에서 숭고한 작업을 위해 sublimetext 에서 제공 하는 지침 을 따르려는 다른 사람을위한 솔루션을 문서화 할 것이라고 생각했습니다 . Sublime Text 3 Sublime Text 3 문서 업데이트
1) 홈 디렉토리 "~ /"에 "bin"이라는 디렉토리를 만듭니다.
mkdir ~/bin
2) 방금 만든 새 디렉토리에 숭고한 텍스트 2 앱에 대한 심볼릭 링크를 만듭니다.
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Sublime Text 3 앱 경로에 대한 업데이트 는 약간 다릅니다.
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
3) OSX에서 경로에 쉽게 추가하는 방법에 대한 Ryan Hoffman의 지침을 따르십시오 . Mac OSX에서 경로에 추가 그의 기술을 사용하여 새로 생성 된 "~ / bin"을 경로에 추가하십시오. 완료되면 / etc / paths 파일이 다음과 같이 표시됩니다 (마지막에 ~ / bin 참고).
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
~/bin
4) 명령 줄에서 subl 사용을 시작하려면 새 터미널 창을 엽니 다.
당신은 할 필요가 없습니다 PATH=$PATH:~/bin/subl
. 대신 PATH=$PATH:~/bin
충분합니다. 그렇게하면 셸이 ~/bin
바이너리 를 조사하도록 지시 합니다. 명령을 사용하여 ~/bin/subl
작동하지 않는 바이너리 의 "폴더"를 살펴 보도록 셸에 지시 했습니다. 또한 두 개의 파일에 명령을 추가 할 필요가 없습니다. 당신에 한 번에 추가 .bashrc
. 저는 bash
전문가는 아니지만 다른 시작 파일에 대한 추가 설명을 위해이 블로그 게시물 을 읽는 것이 좋습니다 .
이 문제에 대한 대안을 제시하고 싶습니다. 경로에 이미있는 디렉토리를 사용하십시오. 이렇게 :
$ sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
tl; dr
Yosemite (OS X 10.10)에서 OS를 새로 설치하면 ~ / bin 디렉토리가 존재하지 않고 경로에없는 동일한 문제가 발생했습니다. 그러나 Sublime에 심볼릭 링크를 배치 할 수있는 유용한 위치가 이미 많이 있습니다.
예를 들어 다음은 현재 내 경로에있는 항목입니다 ( $ echo $PATH
목록을 가져 오는 데 사용 ).
/Applications/Postgres.app/Contents/Versions/9.3/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin:/usr/local/bin
/usr/local/mysql/bin
당신은 쉽게 말한다 일부 변경하여 경로에 이미 위치를 사용하는 스크립트를 수정할 수 있습니다 ~/bin/subl
로를/usr/local/bin/subl
따라서 다음 명령을 실행하면 목표를 달성 할 수 있습니다.
$ sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
먼저에 대한 심볼릭 링크를 만들어야합니다 /usr/bin
. 심볼릭 링크 또는 SymLink는 디렉토리에 대한 별칭 또는 바로 가기입니다. 다음과 같이하십시오 :
먼저 터미널 명령 줄을 사용하여 홈 디렉토리에 있는지 확인하십시오.
cd ~
usr/bin
디렉토리에 대한 심볼릭 링크를 만듭니다 .ln -s /usr/bin bin
Where
ln
= create a link,-s
= symbolic, followed by the[target diectory]
and[name of link]
Test your new link
cd bin
This should take you to your
~/bin
- same as/usr/bin
. The~
indicates there's a long path hidden inside.Now, go back to your Home folder to install the
subl
commandcd ~
Install the Sublime Text 2 command line tool. I'll be using
sudo
to bypass any permission blocks.sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/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.
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.
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.
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.
Here are the full instructions to do this (for Sublime Text 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.
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.
Create a symlink from /usr/bin to ~/bin:
$ sudo ln -s /usr/bin ~/bin
Create a symlink from the Sublime Text 3 CLI tool to ~/bin:
$ sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/bin
Test it.
$ subl .
echo $PATH
and use one of the path already in there. In this example "/usr/local/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.
following works with me. I have Sublime version 3 and posting it here if someone is looking for help:
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /bin/subl
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/
참고URL : https://stackoverflow.com/questions/10767738/how-do-i-add-bin-to-my-path
'program tip' 카테고리의 다른 글
Java에서 '(int) (char) (byte) -2'가 65534를 생성하는 이유는 무엇입니까? (0) | 2020.11.03 |
---|---|
다음 위치 후 원격 파일 이름을 가져 오기 위해 컬 (0) | 2020.11.03 |
SELECT 쿼리에 대한 SQL Server 잠금 이해 (0) | 2020.11.03 |
Android에서 콜백이란 무엇입니까? (0) | 2020.11.03 |
Angular 4에서 클릭시 요소로 스크롤 (0) | 2020.11.03 |