sudo: porto: comando non trovato
-
13-12-2019 - |
Domanda
Recentemente ho disinstallato Xcode 4.2 e reinstallato Xcode 4.3.1.Gli strumenti della riga di comando sono installati.Ho quindi installato Macport utilizzando le immagini del disco "DMG" per Leone da Macports.org.Poiché, mi stavo ricevendo sudo: port: command not found
dopo ogni uso del porto, ho seguito questo e Questo post per creare un.bash_profile
File (non è stato presente in precedenza) e quindi inserisci il seguente ma non disponibile.
export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
.
Seguente Questo 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"
.
Rinominare .bash_profile
a .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) ✗
.
Contenuto .profile
:
export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info
. Soluzione
Assicurati di eliminare ~ / .bash_profile e ~ / .bash_login in modo che .profile possa funzionare.Questo ha funzionato per me http://johnnywey.wordpress.com/2008/ 04/17 / fissaggio-profilo-profilo-in-OS-X /
Altri suggerimenti
In primo luogo, potrebbe essere necessario modificare il percorso del sistema
sudo vi /etc/paths
.
Aggiungi 2 seguenti righe:
/opt/local/bin
/opt/local/sbin
.
Riavvia il terminale
Puoi provare a originare il tuo file del profilo per aggiornare il tuo ambiente:
$ source ~/.profile
. Ho trovato la risposta in Il sito ufficiale
$ vi ~/.profile
# add the following line
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
.
e ora riavvia il terminale o il tipo source !$
(equivalente a source ~/.profile
)
Se si utilizza Zsh.Pli prega di aggiungere una stringa fluente alla linea 'Export Path="..."' In File '~ / .zshrc'
:/opt/local/bin:/opt/local/sbin
. Sulla mia macchina, la porta è in /opt/local/bin/port
- prova a digitare in un terminale da solo.
Se hai appena installato Macports Basta correre e dovrebbe funzionare
source ~/.bash_profile
. Cosa ottieni da eseguire which port
come account utente regolare?Provalo da un terminale appena aperto.Prova di nuovo dopo aver rinominato .bash_profile
a .profile
.Puoi eseguire port
come utente regolare, anche senza argomenti?
Puoi semplicemente aggiungere la linea:
source ~/.profile
.
Alla fine del tuo file RC Shell - se stai usando Bash, allora sarebbe il tuo ~ / .bash_profile se stai usando zsh sarebbe il tuo ~ / .zshrc
Quindi aprire una nuova finestra terminale e digitare le porte -v Dovresti vedere l'output che sembra quanto segue:
~ [ port -v ] 12:12 pm
MacPorts 2.1.3
Entering interactive mode... ("help" for help, "quit" to quit)
[Users/sh] > quit
Goodbye
.
Spero che ti aiuti.
Potrebbe esserci la situazione che la tua macchina è gestita da burattino o giù di lì.Quindi cambiare il file di root .profile o .bash_rc non funziona affatto. Pertanto è possibile aggiungere quanto segue al tuo file .profile.Dopo di ciò puoi usare "mydo" invece di "sudo".Funziona perfettamente per me.
function mydo() {
echo Executing sudo with: "$1" "${@:2}"
sudo $(which $1) "${@:2}"
}
.
Visita la mia pagina: http://www.danielkoitzsch.de/blog/2016/03/16/sudo-returns-xyz-command-not-found/