This article will describe creating install media to USB. This helps reinstall macOS to MacBook which was installed Ubuntu.
1 Download macOS Sierra
Download "Install macOS Sierra" dmg from Mac App Store. Do not upgrade now because dmg file will be removed after upgrade.
This dmg file will be mount to /Applications/Install\ macOS\ Sierra.app.
2 Format USB
Install media needs about 4.83GB size. This article will use 8GByte size USB.
Run Disk Utility.
Finder -> Applications -> Utilities -> Disk Utility
Select USB partition at the left External and erase. This article names myusb with USB.
USB will be mount to /Volume/[Name].
3 Create install media
Create install media with createinstallmedia command.
$ sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia \ --volume /Volumes/myusb \ --applicationpath "/Applications/Install macOS Sierra.app" Ready to start. To continue we need to erase the disk at /Volumes/myusb. If you wish to continue type (Y) then press return: Y
Install media will be mount to "Install macOS Sierra".
4 USB boot
After inserting USB, power on MacBook with pressing Option key. In case of MacBook which was installed Ubuntu is the same way too.
Storage devices will be displayed. Select "Install macOS Sierra" and install macOS.