If you’re trying to create a bootable installer for an older macOS version (like El Capitan) with createinstallmedia, and it fails with a “does not appear to be a valid OS installer” error, quite possible the actual problem is that the digital certificate of your macOS installer has expired. Fortunately, you can easily overcome it by travelling back in time (from the operating system’s perspective, at least).
Step 1. Go to System Preferences > Date & Time > Time Zone and uncheck “Set time zone automatically using current location”.
Step 2. Open Terminal and run this to set the system time to the 10th of October, 2015:
sudo date 1010101015
Enter your password (the characters you type won’t appear on-screen) and press Enter .
Step 3. Run createinstallmedia once again. Hopefully, there will be no errors this time.
Step 4. Go to System Preferences > Date & Time > Time Zone and check “Set time zone automatically using current location”. Wait a few seconds and make sure the OS time is back to current.