Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

terminal - sudo: port: command not found

I recently uninstalled Xcode 4.2 and re-installed Xcode 4.3.1. Command Line Tools are installed. I then installed MacPort using “dmg” disk images for Lion from macports.org. Since, I was getting sudo: port: command not found after every use of port, I followed this and this post to create a .bash_profile file(wasn't present earlier) and then put in it the following but to no avail.

export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info 

Following this post

?  ~ git:(master) ? rvm install 1.8.7 --with-openssl-dir=/opt/local
You requested building with '/usr/bin/gcc-4.2' but it is not in your path.
?  ~ git:(master) ? vi .rvmrc 

rvm_archflags="-arch x86_64"

export CC="/usr/bin/gcc-4.2"

export CFLAGS="-O2 -arch x86_64"
export LDFLAGS="-L/opt/local/lib"
export CPPFLAGS="-I/opt/local/include"

Renaming .bash_profile to .profile

?  ~ git:(master) ? vi .bash_profile
?  ~ git:(master) ? mv .bash_profile .profile
?  ~ git:(master) ? mv .profile              
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory
?  ~ git:(master) ? mv -f .bash_profile .profile
mv: rename .bash_profile to .profile: No such file or directory
?  ~ git:(master) ? port
zsh: correct 'port' to 'pr' [nyae]? n
zsh: command not found: port
?  ~ git:(master) ? which port
port not found
?  ~ git:(master) ? 

.profile content:

export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First, you might need to edit your system's PATH

sudo vi /etc/paths

Add 2 following lines:

/opt/local/bin
/opt/local/sbin

Reboot your terminal


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...