
.bash_profile
Ruby 버전 19와 올바른 gem을 모두 실행하는 별칭 에 일부 데이터를 추가했습니다 . 데이터를 추가하면 더 이상 다음과 같은 명령을 실행할 수 없습니다.맥 포트실행할 명령 포트 또는 명령 파트너텍스트 컴패니언. 비활성화하고 나면 .bash_profile
모든 .bash_login
것이 .bash_history
정상으로 돌아갔습니다. .bash_history
재생성되었으며 곧 .bash_profile
필요한 별칭을 다시 얻었지만 해당 명령을 다시 실행할 수 있는 옵션을 잃었습니다. 다음은 이러한 모든 파일의 일부 출력입니다.
jaspersmbp:~ jasper$ cat .bash_profile
alias ruby='/opt/local/bin/ruby1.9'
alias gem='/opt/local/bin/gem'
jaspersmbp:~ jasper$ cat .bash_login
jaspersmbp:~ jasper$ cat .bashrc
HISTFILESIZE=1000000000
HISTSIZE=1000000
jaspersmbp:~ jasper$ cat .profile
#Django path
export PATH=/opt/local/bin:opt/local/sbin:/opt/local/lib/python2.4/site-packages/django/bin:$PATH
# Apache alias
alias apacherestart='sudo /opt/local/apache2/bin/apachectl -k restart'
#Subversion OSX for Eclips Joomla Development
export PATH=/opt/subversion/bin:$PATH
#Test
#echo $PATH
##
# Your previous /Users/jasper/.profile file was backed up as /Users/jasper/.profile.macports-saved_2012-05-18_at_09:47:58
##
# MacPorts Installer addition on 2012-05-18_at_09:47:58: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
.bash_profile
활성화하면 mate 및 port와 같은 명령이 사용되는 이유 를 아는 사람이 있습니까 ? .bash_profile
별칭을 사용하려면 작업을 꼭 해야 하고 , 다양한 소프트웨어에서 작동하는 MacPorts 포트 명령이 필요합니다.
답변1
Bash는 ~/.bash_profile
존재 여부를 읽습니다 ~/.profile
. 따라서 ~/.bash_profile
을(를) 생성하면 ~/.profile
더 이상 사용되지 않습니다. 다른 셸과 달리 별칭은 bash에만 국한되지 않으므로 ~/.profile
.
또한 대화형 로그인으로 bash를 시작하면 bash는 ~/.bash_profile
또는 (bash 관련 세션 시작 스크립트 또는 존재하지 않는 경우 일반 쉘 세션 시작 스크립트)를 읽지만 (대화형 bash 시작 스크립트)는 ~/.profile
읽지 않습니다 . ~/.bashrc
따라서 다음 두 줄을 파일에 넣어서 ~/.bash_profile
모든 것을 로드해야 합니다.
. ~/.profile
case $- in *i*) . ~/.bashrc;; esac
답변2
PATH
MacPort가 구성 파일을 생성하고 등을 조작하는 것 같습니다 . 이 문제를 해결하는 가장 쉬운 방법은 직접 수행하는 것입니다. MacPort 생성/생성, 삭제 .bash_profile
및 경로 및 별칭과 관련된 도트 파일 파일을 비활성화한 후 파일 .profile
에 다음을 추가합니다 .~/.bashrc
# define aliases
alias ruby='ruby1.9'
alias apacherestart='sudo apachectl -k restart'
# define hist properties
HISTFILESIZE=1000000000
HISTSIZE=1000000
# define path to programs
PATH=/opt/local/bin:opt/local/sbin:/opt/subversion/bin:/opt/local/apache2/bin/:/opt/local/lib/python2.4/site-packages/django/bin:$PATH
# define manpath
MANPATH=/opt/local/share/man:$MANPATH
# export env vars
export HISTFILESIZE HISTSIZE PATH MANPATH
새 터미널을 시작하고 실행하여 echo $PATH
모든 것이 있는지 확인한 다음 에서 설치를 테스트합니다 /opt/local/bin
. 위 명령문의 모든 디렉터리가 PATH=
이제 디렉터리에 있으므로 PATH
바이너리에 대한 절대 경로가 있는 별칭을 사용할 필요가 없습니다. , gem
그냥 실행할 수 있으므로 더 이상 별칭이 필요하지 않습니다 gem
.
업데이트: 소스가 없으면 깨끗한 소스를 ~/.bashrc
넣으세요 .source ~/.bashrc
~/.bash_profile
답변3
$PATH
흠, 뭔가 문제 가 있는 게 아닐까 ? 전후 확인해보셨나요?