If you install the Mac operating system on an external hard drive, thumb drive, or other storage device, your Mac can start up from that device instead of your built-in startup disk. First, make sure that your storage device is properly formatted.
For best results, your external hard drive, thumb drive, SDHC or SDXC card, or other storage device should be formatted as Mac OS Extended, not FAT, ExFAT, or NTFS. And to function as a startup disk, it needs to be using a GUID partition map. Here's how to check:
- Connect your external storage device to your Mac.
- Choose Apple menu () > About This Mac, then click the System Report button. Select Storage from the sidebar, then select your storage device from the list of volumes. Make sure that the Partition Map Type shown for your storage device is GPT (GUID Partition Table). If your storage device isn't using a GUID partition map, you can create one with Disk Utility.
- Select your external storage device in Disk Utility. (Select the disk name, not the volume name indented beneath it.) Then click Erase and choose the GUID partition map scheme and any Mac OS Extended format before erasing.
- Follow the steps for reinstalling macOS, but select your external storage device when the installer asks you to choose a destination disk. The installer needs at least 8GB of available storage space.
This installs a version of macOS that can start up your Mac. It can also start up another Mac, if it's the same macOS version that came with that Mac, or a compatible newer version.
(This how-to is based on my experiences and info on Apple's support pages — where the images sometimes come from.)