The command as described for Mojave results in a "command not found" error.

Instead I dragged and dropped the createinstallmedia file found inside the Install package into the Terminal and when comparing this resulted in a missing backslash after macOS. And this time it worked!

Mac Pro, macOS 10.14

Posted on Sep 5, 2023 11:22 AM

Reply
11 replies

Sep 5, 2023 12:16 PM in response to f1gwr

The error is at the end of your initial attempt per this part:


--volume /Volumes/MyVolume


You tried to tell the installer to install Mojave back into the installer itself. It expects to find a drive volume name there, which you removed. Technically, it should have tried to look for a volume/drive/partition actually named Install macOS Mojave, but it didn't do that.


Since Apple can't know what name(s) your volumes/drive/partitions are, they use the placeholder, MyVolume. The user has to replace that with the name of the volume/drive/partition the install is going to.


So, if you were installing Mojave to a flash drive to create a bootable installer, you would replace MyVolume with the name of the flash drive. I always name the drive something very simple, such as just the letter a. The flash drive will be renamed by the installer during the process anyway. The command then ends up being:


sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/a

Sep 5, 2023 1:16 PM in response to Kurt Lang

Yeah. Unless Apple's command is incorrect (I'm not saying it, bash does!), which doesn't seem to be part of your hypothesis...

My guess is that the antislash means "everything that follows is text, and is not part of the command, until next slash" here a space that separates arguments (command-space) and *not* antislash-space that would mean a text-space. Therefore if multiple spaces in the file name, only one backslash is needed.

What do you think of that?

Sep 5, 2023 11:28 AM in response to f1gwr

That it didn't work could be caused by a couple of things. Apple's command line text:


sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume


  1. The command expects to find the Mojave installer in the Applications folder. If you moved it, the command won't work unless you modify the text to match where it's currently located. Or, move the installer back into the Applications folder.
  2. You renamed the installer.

Sep 5, 2023 1:34 PM in response to f1gwr

To account for spaces in name, you used to have to enclose it in quotes, so it would look something like this:


sudo /Applications/"Install macOS Mojave.app"/Contents/Resources/createinstallmedia --volume /Volumes/a


Apple changed Terminal to understand a backslash as meaning the following space is a character as part of a name, not a syntax break.


That's why the second line you used - that worked - is very, very odd. It should have been parsed as an impossible location and name.


/Applications/Install\ macOS Mojave.app/


That should have told terminal there was a file or folder within the Applications folder named Install macOS. But then followed by an indecipherable Mojave.app, sitting out by itself. Without the \ after macOS, the following space should have been treated as a syntax break, not a character space. Therefore, it wouldn't be able to find an app named Mojave.


Curiouser and Curiouser.

Sep 6, 2023 9:16 AM in response to f1gwr

I have no idea why the original command did not work, yet the second one did since the second command has an incorrect path listed since the spaces are not properly escaped or quoted. The two valid ways of issuing the command is either with the backslashes to escape spaces in the path, or putting quotes around the path.


Apple's example:

sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia  --volume  /Volumes/MyVolume


Equivalent command using quotes instead of backslashes to handle the spaces within the path:

sudo "/Applications/Install macOS Mojave.app/Contents/Resources/createinstallmedia"  --volume  /Volumes/MyVolume


It is even possible to only place the quotes in the middle of the path, but that would just make it awkward & confusing, but it is technically possible even if it is bad form.



The only thing I can think of is that you have some kind of customized Bash configuration...what that could be I have no idea since I've never seen anything like it. If it did work, then you do notice that you still had a backslash in the path both for "createinstallmedia" portion just after "Install" and the same for the path to the mounted volume as well.


Personally I would be concerned about your Bash configuration as its behavior is highly unusual.

Sep 5, 2023 12:01 PM in response to Kurt Lang

Sorry but nope!

Didn't rename this file as far as I remember (did it with different Catalina downloads), and it's located into the Application folder. See attached screen copies:



...see the file reads as "Install\ macOS Mojave.app" without a backslash after macOS in my succeeding command, while Apple wrote "Install\ macOS\ Mojave.app" in the referred discussion page (Create a bootable installer for macOS - Apple Support) which returns error message.

Sep 5, 2023 12:29 PM in response to Kurt Lang

Sorry again I did initially use the name InstallMojave for my USB stick. But as I quit Terminal since last creation before I posted my message, the Terminal window was erased and didn't want to restart the whole process, so I used the created stick with the name createinstallmedia used for it. Do you really want me to restart the whole process (erase the USB stick and recreate the installer) to prove that what I say is true?


Anyway the destination has nothing to do with the "command not found error", as the error would be different if the USB stick would not be found (don't ask me how I know it).

Sep 5, 2023 12:38 PM in response to f1gwr

Do you really want me to restart the whole process (erase the USB stick and recreate the installer) to prove that what I say is true?

Of course not. I could only comment based on the screen shot you posted. Unless you actually had a destination drive named Install macOS Mojave, it wasn't possible for the first line in Terminal to work.


And then, that wasn't even the error it bounced back, which should have been, volume not found.


Why the second one worked, which included incorrect syntax (no \ after macOS), is anyone's guess.

Sep 6, 2023 12:44 PM in response to HWTech

As far as I remember, never modified the Bash nor the Terminal in any way. The working path is the one generated by the drag and drop. Similarly, didn't modify the Finder wilingly.

So this will remain a mystery.


Would be interesting if someone tried the USB stick generation in real world... Or at least open the Mojave Install package content with right-click, go to /Contents/Ressources/createinstallmedia, and drag and drop the file into a Terminal window, just to watch how the link spells there.

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.

The command as described for Mojave results in a "command not found" error.

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