<div dir="ltr"><div dir="ltr">On Fri, Apr 3, 2020 at 6:59 AM Hans Fredrik Johansson <<a href="mailto:fjohansson1212@gmail.com" target="_blank">fjohansson1212@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
But when I type « sudo port selfupdate » they ask for my password:<br>
        Password:<br>
<br>
I tried my login password (for fjhome account) and got the answer:<br>
        fjhome is not in the sudoers file.  This incident will be reported.<br></blockquote><div><br></div><div>This does not work because, as you guessed, this user is not admin. Only admin can use sudo with their own password to become root.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If I try the password for the admin I get :<br>
Sorry, try again.<br></blockquote><div><br></div><div>This doesn't work because sudo doesn't accept any account's password, only the current one's.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
if I log my self as « su - admin » and tape again « port version »  I get:<br>
-bash: port: command not found<br></blockquote><div><br></div><div>This doesn't work because the MacPorts installer added the location of the 'port' command to the PATH set up in the .bash_profile file for the account you ran it as but not any other account. 'sudo' transfers over your $PATH but 'su' does not. Also, if it had found the port command, you would have gotten the "Insufficient privileges" error because MacPorts is not running as root.</div><div><br></div><div>Here is what you need to do: first, "su admin" so that you are using the admin account. Then, use both sudo and the full path to the port command: "sudo /opt/local/bin/port selfupdate".</div><div><br></div><div>In order to avoid needing to use the full path in the future, find the section in your .bash_profile file (actually, I don't know how this works if your login shell is zsh...) which MacPorts added that looks like this:</div><div><br></div><div>





<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:9px;line-height:normal;font-family:Monaco;color:rgb(0,0,0);background-color:rgb(255,216,202)"><span style="font-variant-ligatures:no-common-ligatures"># MacPorts Installer addition on 2016-02-04_at_14:31:04: adding an appropriate PATH variable for use with MacPorts.</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:9px;line-height:normal;font-family:Monaco;color:rgb(0,0,0);background-color:rgb(255,216,202)"><span style="font-variant-ligatures:no-common-ligatures">export PATH="/opt/local/bin:/opt/local/sbin:$PATH"</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:9px;line-height:normal;font-family:Monaco;color:rgb(0,0,0);background-color:rgb(255,216,202)"><span style="font-variant-ligatures:no-common-ligatures"># Finished adapting your PATH environment variable for use with MacPorts.</span></p></div><div><br></div><div>and copy it into the same file for your admin account. Then "sudo port selfupdate" will work when run from the admin account.</div></div></div>