-bash: sudo: command not found

I'm using terminal and when I type in:


" sudo diskutil unmountDisk force /dev/disk1"


all it show up was:






"-bash: sudo: command not found"






Help!!!!






It's a Mac OS X v10.10 Yosemite

Posted on Nov 23, 2016 8:11 PM

Reply
Question marked as ⚠️ Top-ranking reply

Posted on Nov 24, 2016 9:35 AM

No matter what I type, the only thing that shows up is "command not found" or "no such file or directory"

4 replies
Sort By: 

Nov 24, 2016 9:42 AM in response to Shengmai

This generally means you have managed to mess up your PATH environment variable.


To execute your command you could use

/usr/bin/sudo /usr/sbin/diskutil unmountDisk force /dev/disk1

This is a short term solution.


Chances are you have one of the following shell initialization files and it has a broken export PATH

.bash_profile

.bash_login

.profile

.bashrc

Use this command to see if you have any of these files:

cd $HOME

/bin/ls .bash_profile .bash_login .profile .bashrc

By default none of these files exist in your home directory.


If you have one of these files you can edit it using

/usr/bin/nano .name_of_file

Or use a GUI based text editor, such as TextWrangler

<http://www.barebones.com/products/textwrangler/>

You should either fix PATH modification, or remove the broken PATH modification


After making a change to your shell initialization file, you should quit the Terminal session and start a new one so that the modified shell initialization file is re-loaded into the shell.


You could also rename the broken shell initialization file and fix it later.

/bin/mv .name_of_file saved.name_of_file

Or you can just delete it

/bin/rm .name_of_file

Again, quit and start a new Terminal session.

Reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

-bash: sudo: command not found

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.