You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Troubling installing OS X El Capitan through terminal and thumb drive. Problems with Terminal commands

I'm trying to restore to factory settings my 2009 MacBook Pro (it had become so slow that a clean slate would solve the problem). I first encountered "sudo: command not found" after writing "sudo/ Applications/Install\ OS\ X\El\ Capitan.app/Content/Resources/createinstallmedia --volume/Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app"


Then I read in the posts that I should try: "/bin/echo $PATH"

And I got:


/usr/bin:/bin:/usr/sbin:/sbin


and then I wrote:


export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH


(I really should not be just copying and pasting code that I found in the support pages since my situation is different from the other users)


And I believe I've added too much code.


How do I undo this last step? I suspect that I have embedded my folders unnecessarily into other folders. I'm not sure.


Thank you so much!

MacBook Pro 13", OS X 10.11

Posted on May 1, 2020 4:39 PM

Reply
Question marked as Top-ranking reply

Posted on May 1, 2020 5:19 PM

Hello,


Please refer to the following Apple Support documents.


How to reinstall macOS from macOS Recovery - Apple Support


How to create a bootable installer for macOS - Apple Support

Similar questions

6 replies

May 5, 2020 8:25 PM in response to Heej973

Sorry for the delay in getting back to you as I've been really busy with work. I did check the location of "sudo" on one of my Macs to verify its location, but I forget exactly which location it was in (I think it was in "/usr/bin"). I'll try to double check tomorrow when I'm working on a Mac.


The Macs I'm currently working on are all managed so I cannot be sure the $PATH is the macOS default. The value of $PATH for this managed Mac was: "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin".


also when I run:

find / -iname sudo 2>/dev/null

I get my original prompt:

-bash-3.2#

It seems you don't have a copy of "sudo" on your Mac for whatever reason.


Can you boot into Recovery Mode using Command + R? Maybe you can create the USB installer while in Recovery Mode. I don't know if this is possible since Recovery Mode doesn't include access to all the utilities which may be needed to create the USB installer.


I would highly recommend you have a good backup of your data and try to reinstall macOS over top of itself from Recovery Mode. Just make sure you are reinstalling the same version of macOS or a newer version. If this is successful, then you can try to create the USB installer again.

May 2, 2020 5:57 PM in response to Heej973

Quit the Terminal and relaunch it. Double-check you have the default path by running the command:

echo  $PATH


If you have the default path listed, then run the following command to see if you can locate "sudo":

find  /  -iname  sudo  2>/dev/null



Explanation of the above command: The "find" command will search the whole boot drive ("/") for "sudo" irrespective if any of the characters are upper or lower case ("-iname") and will get rid of any error messages ("2>/dev/null").


I'm not at a Mac right now, but "sudo" should be located in one of these locations: "/bin", "/sbin", "/usr/bin", or "/usr/sbin".


Before running any commands from the Internet you really should research what they are doing to get a general idea of what will happen. You can always get more information about a command using "man" to get the manual pages for a command, or by using the "-h" or "--help" option with the command to get a summary help information about the command. For example to get more information about "sudo":

man  sudo
sudo  -h
sudo  --help


Are you running any anti-virus, security, or cleaning apps which may be interfering with the normal operation of the Mac?

Troubling installing OS X El Capitan through terminal and thumb drive. Problems with Terminal commands

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