And although downloaded as an application from the Mac App Store, Install Mac OS X Lion.app, contained within it is the disk image that makes the OS X Lion installer magic happen: InstallESD.dmg. InstallESD.dmg does more than just handle the initial Lion installation.
Editor's note: This article is part of our. We also have a. Unlike previous versions of Mac OS X, Lion (OS X 10.7) doesn’t ship on a bootable disc—it’s available only as an installer app downloadable from the Mac App Store, and that installer doesn’t require a bootable installation disc. Indeed, this lack of physical media is perhaps the biggest complaint about Lion’s App Store-only distribution, as there are a good number of reasons you might want a bootable Lion installer, whether it be a DVD, a thumb drive, or an external hard drive. For example, if you want to on multiple Macs, a bootable installer drive can be more convenient than downloading or copying the entire Lion installer to each computer.
Also, if your Mac is experiencing problems, a bootable installer drive makes a handy emergency disk. (Lion features a new (also called Lion Recovery), but not all installations of Lion get it—and if your Mac’s drive is itself having trouble, recovery mode may not even be available.
Also, if you need to reinstall Lion, recovery mode requires you to download the entire 4GB Lion installer again.) Finally, a bootable installer drive makes it easier to (assuming you have the license to do so). Thankfully, it’s easy to create a bootable Lion-install volume from the Lion installer that you download from the Mac App Store; just follow the steps below. Update: When this article was originally published, the Mac App Store version of Lion would not boot any Macs released in mid-2011 or later, as those models shipped with a newer version of Lion preinstalled. However, unlike with the CD- and DVD-based Mac OS X installers of old, Apple can—and does—update the Mac App Store version of the Lion installer. So if you create a bootable Lion-installer drive using the current version of the Lion installer—which, as of 2/10/2012, installs OS X 10.7.3—that drive will work with all current Lion-capable Macs. If your only Mac was released after Lion, so you can't download the Lion installer from the Mac App Store, I've also Part 1: For all types of media.
Once you’ve purchased Lion, find the Lion installer on your Mac. It’s called Install Mac OS X Lion.app and it should have been downloaded to /Applications. Right-click (or Control+click) the installer, and choose Show Package Contents from the resulting contextual menu. In the folder that appears, open Contents, then open Shared Support; you’ll see a disk-image file called InstallESD.dmg. Launch Disk Utility (in /Applications/Utilities). Drag the InstallESD.dmg disk image into Disk Utility’s left-hand sidebar.
Right-click (or Control+click) on the Lion installer to view its contents. The next steps depend on whether you want to create a bootable hard drive or flash drive, or a bootable DVD. I recommend a hard drive or flash drive—a DVD will work, but it takes a long time to boot and install. To create a bootable hard drive or flash drive.
In Disk Utility, select InstallESD.dmg in the sidebar, and then click the Open button in the toolbar. This mounts the disk image’s volume in the Finder. The mounted volume is called Mac OS X Install ESD. Click Mac OS X Install ESD in Disk Utility’s sidebar, then click the Restore button in the main part of the window. Drag the Mac OS X Install ESD icon into the Source field on the right (if it isn’t already there).
Connect to your Mac the hard drive or flash drive you want to use for your bootable Lion installer. This drive must be at least 5GB in size (an 8GB flash drive works well), and it must be formatted with a GUID Partition Table. Follow to properly format the drive.
In Disk Utility, find this destination drive in the sidebar and then drag it into the Destination field on the right; if the destination drive has multiple partitions, just drag the partition you want to use as your bootable installer volume. Warning: The next step will erase the destination drive or partition, so make sure it doesn’t contain any valuable data. Click Restore and, if prompted, enter an admin-level username and password.
The restore procedure will take anywhere from five to 15 minutes, depending on your Mac and the speed of your drive. Note: In versions of the Lion installer prior to 10.7.4, you didn’t need to first mount the InstallESD.dmg image—you could simply drag the image itself into the Source field. However, with the 10.7.4 installer, you must use the mounted Mac OS X Install ESD volume or you will get an error at the end of the restore procedure and the newly created bootable drive may not function properly. You can use Disk Utility's Restore screen to create a bootable flash drive or hard drive. Part 2b: To create a bootable DVD. In Disk Utility, select InstallESD.dmg in the sidebar. Click the Burn button in the toolbar.
When prompted, insert a blank DVD (a single-layer disc should work, although you can use a dual-layer disc instead), choose your burn options, and click Burn. You can now boot any Lion-compatible Mac from this drive or DVD and install Lion.
You can also use any of the Lion installer’s special —in fact, when you boot from this drive or DVD, you’ll see the same Mac OS X Utilities screen you get when you boot into restore mode. Note: As explained in, if you leave the Lion installer in its default location (in /Applications) and use it to install Lion on your Mac’s startup drive, the installer will be automatically deleted after the installation finishes. So if you plan to use that installer on other Macs, or to create a bootable disc or drive as explained here, be sure to copy the installer to another drive—or at least move it out of the Applications folder—before you install. If you don't, you'll have to re-download the entire thing from the Mac App Store. If you've already installed Lion—so it's too late to move the installer—you've may find that the Mac App Store claims that Lion is already installed and prevents you from downloading it again.
As I explained in our main Lion-installation article, you should be able to force a re-download using one of the following three tricks: First, Option+click the Buy App button in the Mac App Store. If that doesn't work, switch to the Mac App Store's main page and then Option+click the Purchases button in the toolbar. If that doesn't work, quit the Mac App Store app and then hold down the Option key while launching the Mac App Store again.
One of these three procedures should get rid of the 'Installed' status for Lion and let you download it. Update: Apple appears to have recently made this process easier: If you previously purchased Lion from the Mac App Store, the button next to Lion in the Store should simply say Download—click it to re-download the installer. Updated 7/20/2011, 10am, to add note about moving the Lion installer package to prevent it from being deleted. Updated 7/22/2011, 11:10am, to add instructions for forcing a re-download of the Lion installer, if necessary. Updated 8/8/2011, 9:19am, with additional information about thumb-drive capacity and drive format. Updated 8/19/2011, 2pm, to clarify compatibility.
Updated 2/10/2012, 12pm, with information about compatibility when using the latest Lion installer, and to note easier re-downloading of Lion installer. Updated 6/27/2012, 9pm, to add note about Disk Utility error message introduced with the 10.7.4 installer, and 6/29/2012, 8:20am, to update instructions so they work when creating a drive using the 10.7.4 installer.
Thanks, Andrew - this is just what the doctor ordered. My wife's laptop has a copy of Yosemite that got stuck 99% of the way through the FileVault encryption process, and thus has never been willing to accept an upgrade to El Capitan. It seems to work fine otherwise, but is just begging for a clean install of Sierra to resolve this issue. You can disable FileVault temporarily to get around this problem. You can do it in the recovery boot GUI if you want. Disabling FileVault is not required to do an update, but I had to do it because I was doing an upgrade of the SSD in a mac. Just wanted to add that to make sure I wasn't causing confusion.
I really wish Apple would start tying the OS upgrades to the hardware instead of my Apple Store account. It's so annoying to have to go back and downgrade an old Mac fix or six OS versions if you want to sell it on Craigslist because otherwise the person you sell it to won't be able to restore it later unless they have a valid liscense in the App Store. Now, it's proabably pretty easy for the new owner to just go into the store and buy the upgrade as soon as they get it, but it is still rather annoying that Apple hasn't found a better solution for MacOS upgrades. Say what you will about Microsoft, but at least their free upgrade model for Win 10 is set up so that it pretty easy for end users to deal with. Thanks, Andrew - this is just what the doctor ordered. My wife's laptop has a copy of Yosemite that got stuck 99% of the way through the FileVault encryption process, and thus has never been willing to accept an upgrade to El Capitan.
It seems to work fine otherwise, but is just begging for a clean install of Sierra to resolve this issue. You can disable FileVault temporarily to get around this problem. You can do it in the recovery boot GUI if you want. Disabling FileVault is not required to do an update, but I had to do it because I was doing an upgrade of the SSD in a mac. Just wanted to add that to make sure I wasn't causing confusion.
Dont do this. Don't disable FileVault when enabled. The only way to truly make deletable data unrecoverable is to encrypt it first, before it ever hits the disk. Disabling FileFault defeats that protection. I really wish Apple would start tying the OS upgrades to the hardware instead of my Apple Store account. It's so annoying to have to go back and downgrade an old Mac fix or six OS versions if you want to sell it on Craigslist because otherwise the person you sell it to won't be able to restore it later unless they have a valid liscense in the App Store. I don't believe this has ever been the case with OS releases.
![Dmg Dmg](http://www.mac.fester.de/grafik/mcf-lioninstcd-08.png)
Applications are tied to the app store account, but not OS releases. EDIT: Apparently, Internet Recovery does the 'downgrade' automatically. I really wish Apple would start tying the OS upgrades to the hardware instead of my Apple Store account. It's so annoying to have to go back and downgrade an old Mac fix or six OS versions if you want to sell it on Craigslist because otherwise the person you sell it to won't be able to restore it later unless they have a valid liscense in the App Store. I don't believe this has ever been the case with OS releases. Applications are tied to the app store account, but not OS releases. EDIT: Apparently, Internet Recovery does the 'downgrade' automatically.
I regularly do installations of old and new versions of the OS, and don't even need an Apple ID for OS-related updates. Doing a clean install from a backup image created using the command line method listed here, I run the install, say 'no' to the Apple ID prompt, set up the system, then launch App Store and go to Updates, declining Apple ID when prompted for it. The OS updates are listed, and download and install properly.
If you get fresh installers for each major release on a regular basis, then you can even use this method to do a 'clean' install of the OS and leave it at the registration prompt for the next owner. Bundle in an 8GB USB stick with an installer as a bonus. Just remember to disassociate your hardware from your Apple ID before you wipe it and sell it. You can also use an 8GB SD card too, for any Mac that includes an SD slot (most of them do that support macOS Sierra).
Apple included the 'createinstallmedia' utility with OS X Mavericks and later. So all you have to do is copy and paste the terminal command and you are good to go. You don't have to wait for some developer to update their program when the terminal command works every time. Does this work with older macbooks?
I think i tried to update my 2010 macbook pro with a SD card to do a clean install and it didn't work. I had to use an USB stick instead. I really wish Apple would start tying the OS upgrades to the hardware instead of my Apple Store account. It's so annoying to have to go back and downgrade an old Mac fix or six OS versions if you want to sell it on Craigslist because otherwise the person you sell it to won't be able to restore it later unless they have a valid liscense in the App Store.
Now, it's proabably pretty easy for the new owner to just go into the store and buy the upgrade as soon as they get it, but it is still rather annoying that Apple hasn't found a better solution for MacOS upgrades. Say what you will about Microsoft, but at least their free upgrade model for Win 10 is set up so that it pretty easy for end users to deal with.
MS authenticates against a valid SN every time despite you thinking it seamlessly and magically just works. Yes you can upgrade Windows without pinging MS but the updates from their servers thereafter are iffy at best. Thanks, Andrew - this is just what the doctor ordered. My wife's laptop has a copy of Yosemite that got stuck 99% of the way through the FileVault encryption process, and thus has never been willing to accept an upgrade to El Capitan. It seems to work fine otherwise, but is just begging for a clean install of Sierra to resolve this issue. You can disable FileVault temporarily to get around this problem. You can do it in the recovery boot GUI if you want.
Disabling FileVault is not required to do an update, but I had to do it because I was doing an upgrade of the SSD in a mac. Just wanted to add that to make sure I wasn't causing confusion. Dont do this. Don't disable FileVault when enabled. The only way to truly make deletable data unrecoverable is to encrypt it first, before it ever hits the disk. Disabling FileFault defeats that protection.
So do you think it wasn't necessary. I had to disable FileVault when switching out my SSD because the backup I made with FileVault On wasn't restoring properly. Now that I think about it, I may have had to enter the FileVault password in the recovery boot GUI screen. Not sure what tripped me up.
Andrew overcomplicates this process every time he writes up an 'install mac os' article. You're taking the long way around and making the process more dificult than it needs to be. You don't need 3rd party tools or the command line ever to make a bootable Mac bootable disc. Disk Utility is all you need. Enlighten us then, because it's not obvious to me what you're supposed to do with the downloaded installer.app and Disk Utility, and all the top Google results and Apple support articles suggest using createinstallmedia.
Show me how it's easier than running 1 long command. Andrew overcomplicates this process every time he writes up an 'install mac os' article. You're taking the long way around and making the process more dificult than it needs to be.
You don't need 3rd party tools or the command line ever to make a bootable Mac bootable disc. Disk Utility is all you need.
Enlighten us then, because it's not obvious to me what you're supposed to do with the downloaded installer.app and Disk Utility, and all the top Google results and Apple support articles suggest using createinstallmedia. Show me how it's easier than running 1 long command. You used to be able to create a bootable USB stick by restoring a DMG file located inside the installer app to a USB stick using Disk Utility. But the last version of OS X that worked on was 10.8.
Beginning with 10.9, the best/only way to create a bootable USB is via createinstallmedia, or one of the third party GUI apps that likely just uses that command behind the scenes. Too bad Apple doesn't provide its own first-party GUI utility, like MS does.
That is weird, but. Having used MS' GUI utility. I think I'll take the command line. Lol I use Rufus on the Windows side these days.
I have a lot of trouble with MS' version throwing errors when copying the files to the USB drive. I can usually work around it by wiping and repartitioning the USB drive, but that's a hassle and even that is hit-or-miss. On the same device, even - usually it'll work, sometimes not. Rufus has never failed to create a bootable installer for me. Andrew overcomplicates this process every time he writes up an 'install mac os' article. You're taking the long way around and making the process more dificult than it needs to be. You don't need 3rd party tools or the command line ever to make a bootable Mac bootable disc.
Disk Utility is all you need. Enlighten us then, because it's not obvious to me what you're supposed to do with the downloaded installer.app and Disk Utility, and all the top Google results and Apple support articles suggest using createinstallmedia. Show me how it's easier than running 1 long command. He's probably refering to the (unofficial) method where you:. Right-click the macOS installer app and choose 'Show Package Contents'. Navigate to 'Install macOS Sierra.app' 'Shared Support' 'InstallESD.dmg'.
Insert USB media. Open Disk Utility, left-click once in the USB stick listed in the left-hand side of Disk Utility's app window, choose 'Edit' 'Restore.' , click in the 'Image.'
![Installesd.dmg download Installesd.dmg download](http://cdn.osxdaily.com/wp-content/uploads/2013/06/create-os-x-mavericks-boot-install.jpg)
Button on the right, select the 'InstallESD.dmg' image we navigated to above and then click in 'Restore' Is this difficult to do? Nope, but it is neither the official way nor is it easier than entering a single command in Terminal.app. Edit: Ninja'd by Maltz, and apparently this method no longer works, either. Could very well be since I haven't tried this in years. I prefer the 'official' method. Andrew overcomplicates this process every time he writes up an 'install mac os' article.
You're taking the long way around and making the process more dificult than it needs to be. You don't need 3rd party tools or the command line ever to make a bootable Mac bootable disc. Disk Utility is all you need. Enlighten us then, because it's not obvious to me what you're supposed to do with the downloaded installer.app and Disk Utility, and all the top Google results and Apple support articles suggest using createinstallmedia. Show me how it's easier than running 1 long command.
He's probably refering to the (unofficial) method where you:. Right-click the macOS installer app and choose 'Show Package Contents'. Navigate to 'Install macOS Sierra.app' 'Shared Support' 'InstallESD.dmg'. Insert USB media. Open Disk Utility, left-click once in the USB stick listed in the left-hand side of Disk Utility's app window, choose 'Edit' 'Restore.' , click in the 'Image.' Button on the right, select the 'InstallESD.dmg' image we navigated to above and then click in 'Restore' Is this difficult to do?
Nope, but it is neither the official way nor is it easier than entering a single command in Terminal.app. Edit: Ninja'd by Maltz, and apparently this method no longer works, either. Could very well be since I haven't tried this in years. I prefer the 'official' method. Last I looked, the DMG is still there, and you can still restore it to a USB stick, so I can see how people might think it's still an option.
But the end result isn't bootable anymore. It was very frustrating until I learned about createinstallmedia.
You can also use an 8GB SD card too, for any Mac that includes an SD slot (most of them do that support macOS Sierra). Apple included the 'createinstallmedia' utility with OS X Mavericks and later. So all you have to do is copy and paste the terminal command and you are good to go.
You don't have to wait for some developer to update their program when the terminal command works every time. Does this work with older macbooks? I think i tried to update my 2010 macbook pro with a SD card to do a clean install and it didn't work.
I had to use an USB stick instead. Yeah, older Macs can't boot off an SD card. If you want the install to run with decent performance you'll choose a disk with decent performance - or just copy the installer app over to other macs via ethernet and not bother with bootable media.
Installing from the internal SSD is much quicker than over USB. You can also use an 8GB SD card too, for any Mac that includes an SD slot (most of them do that support macOS Sierra). Apple included the 'createinstallmedia' utility with OS X Mavericks and later. So all you have to do is copy and paste the terminal command and you are good to go.
You don't have to wait for some developer to update their program when the terminal command works every time. Does this work with older macbooks?
I think i tried to update my 2010 macbook pro with a SD card to do a clean install and it didn't work. I had to use an USB stick instead. The SD card must be formatted with GPT. For whatever reason, createinstallmedia doesn't change the partition type when it asks you to erase the volume so it remains an unbootable MBR disk. (I just ran into this problem two days ago, actually).
If you're going to do the boot/installer the 'old' way via Disk Utility. 1) Right-click on 'Install macOS Sierra.app' and choose 'Show Package Contents' 2) Go to Contents SharedSupport and open disk image 'InstallESD.dmg' 3) There is a hidden disk image in there called 'BaseSystem.dmg', to open go to the Terminal and type - open /Volumes/OS X Install ESD/BaseSystem.dmg 4) Once that is mounted, go to Disk Utility and restore the mounted volume called 'OS X Base System' to a 8gb min drive. 5) Once done, navigate on the newly restored volume to /System/Installation, and delete the file alias called 'Packages'. 6) On the OS X Install ESD Volume, copy the folder 'Packages' to the where you just removed the file alias. You will have a bootable drive and be able to install from it. This process has been this way since 10.8.
This is the long way around when the cli works real quick and simple. Thanks, Andrew - this is just what the doctor ordered.
My wife's laptop has a copy of Yosemite that got stuck 99% of the way through the FileVault encryption process, and thus has never been willing to accept an upgrade to El Capitan. It seems to work fine otherwise, but is just begging for a clean install of Sierra to resolve this issue. You can disable FileVault temporarily to get around this problem. You can do it in the recovery boot GUI if you want. Disabling FileVault is not required to do an update, but I had to do it because I was doing an upgrade of the SSD in a mac. Just wanted to add that to make sure I wasn't causing confusion. Dont do this.
Don't disable FileVault when enabled. The only way to truly make deletable data unrecoverable is to encrypt it first, before it ever hits the disk. Disabling FileFault defeats that protection.
So do you think it wasn't necessary. I had to disable FileVault when switching out my SSD because the backup I made with FileVault On wasn't restoring properly. Now that I think about it, I may have had to enter the FileVault password in the recovery boot GUI screen.
Not sure what tripped me up. I'm not sure how you were doing backups, but Time Machine doesn't do raw block backups, so the encryption state isn't retained and the unencrypted data. is backed up instead. If there was an issue that disabling FileVault actually fixed, it would been in the CoreStorage logical volume wrapper. However, such an issue wouldn't have even allowed you to see the volume to disable FileVault.the backed up data inherits the encryption of the destination disk, so if the destination is an encrypted volume, the backup gets re-encrypted as well. Thanks, Andrew - this is just what the doctor ordered. My wife's laptop has a copy of Yosemite that got stuck 99% of the way through the FileVault encryption process, and thus has never been willing to accept an upgrade to El Capitan.
It seems to work fine otherwise, but is just begging for a clean install of Sierra to resolve this issue. You can disable FileVault temporarily to get around this problem. You can do it in the recovery boot GUI if you want. Disabling FileVault is not required to do an update, but I had to do it because I was doing an upgrade of the SSD in a mac.
Just wanted to add that to make sure I wasn't causing confusion. Dont do this.
Don't disable FileVault when enabled. The only way to truly make deletable data unrecoverable is to encrypt it first, before it ever hits the disk. Disabling FileFault defeats that protection. So do you think it wasn't necessary. I had to disable FileVault when switching out my SSD because the backup I made with FileVault On wasn't restoring properly.
Now that I think about it, I may have had to enter the FileVault password in the recovery boot GUI screen. Not sure what tripped me up. I'm not sure how you were doing backups, but Time Machine doesn't do raw block backups, so the encryption state isn't retained and the unencrypted data. is backed up instead.
If there was an issue that disabling FileVault actually fixed, it would been in the CoreStorage logical volume wrapper. However, such an issue wouldn't have even allowed you to see the volume to disable FileVault.the backed up data inherits the encryption of the destination disk, so if the destination is an encrypted volume, the backup gets re-encrypted as well. I think I did this method so I bypassed Time Machine completely. I didn't know what I was doing and the restore from the original disk wasn't working. I rebooted with the original disk disabled FileVault and then the restore worked correctly. So it was PEBKAC but disabling it momentarily helped.
Thanks for responding. You can also use an 8GB SD card too, for any Mac that includes an SD slot (most of them do that support macOS Sierra). Apple included the 'createinstallmedia' utility with OS X Mavericks and later. So all you have to do is copy and paste the terminal command and you are good to go. You don't have to wait for some developer to update their program when the terminal command works every time.
Does this work with older macbooks? I think i tried to update my 2010 macbook pro with a SD card to do a clean install and it didn't work. I had to use an USB stick instead. Installations typically do not work with SD cards because they are connected differently in a way that the computer can't boot from them. Same thing on PC as well, unless you use a USB SD card reader. I really wish Apple would start tying the OS upgrades to the hardware instead of my Apple Store account. It's so annoying to have to go back and downgrade an old Mac fix or six OS versions if you want to sell it on Craigslist because otherwise the person you sell it to won't be able to restore it later unless they have a valid liscense in the App Store.
Now, it's proabably pretty easy for the new owner to just go into the store and buy the upgrade as soon as they get it, but it is still rather annoying that Apple hasn't found a better solution for MacOS upgrades. Say what you will about Microsoft, but at least their free upgrade model for Win 10 is set up so that it pretty easy for end users to deal with. You're speaking a bit too soon: they're toying with digital licenses. Right now, if you have an OEM version of an OS and sell the device, and that installation dies, it has the same issue on Windows 10. The new owner will have to shell for a new copy because the license is yours. I am not sure if you can just call them if you have the OEM key (You probably can because that's what the Hardware ID checks), but if you don't have the license it is essentially the same problem. The methods linked here work wonderfully.
To those having problems upgrading, especially using FileVault: Do an Apple diagnostics (the basic one). I have had a couple of macbook pros have issues with the SATA devices which turned out to be bad ribbon cables. I suggest you use magnification tools if you're opening them up to double check. This is on the older (Mid 2012 and below) models. The newer models with the PCI-E drives that's a whole other ballgame if you're having issues upgrading. As a side note, as of right now the only software in my organization that I found to not be working with the upgrade is Abby FineReader Pro.
Their support has only a spec of mention and it's really hard to find, saying that at this moment it is not supported and that if it is supported at some point they will add it to their product page. You can also use an 8GB SD card too, for any Mac that includes an SD slot (most of them do that support macOS Sierra). Apple included the 'createinstallmedia' utility with OS X Mavericks and later. So all you have to do is copy and paste the terminal command and you are good to go. You don't have to wait for some developer to update their program when the terminal command works every time.
Does this work with older macbooks? I think i tried to update my 2010 macbook pro with a SD card to do a clean install and it didn't work. I had to use an USB stick instead. Installations typically do not work with SD cards because they are connected differently in a way that the computer can't boot from them. Same thing on PC as well, unless you use a USB SD card reader. All SD slots in Macs are on the USB bus. I have installed OS X El Capitan using an SD card with a Mid-2009 MacBook Pro 13' model using an 8GB SanDisk Ultra SDHC Card.
The card was formatted GPT and OS X Extended (Journaled) and the boot disk was created using the Terminal command. Hold option on restart and choose the SD card as the boot disk and it boots from the SD card. I really wish Apple would start tying the OS upgrades to the hardware instead of my Apple Store account.
It's so annoying to have to go back and downgrade an old Mac fix or six OS versions if you want to sell it on Craigslist because otherwise the person you sell it to won't be able to restore it later unless they have a valid liscense in the App Store. Now, it's proabably pretty easy for the new owner to just go into the store and buy the upgrade as soon as they get it, but it is still rather annoying that Apple hasn't found a better solution for MacOS upgrades.
Don't use the Command-R recovery mode to re-install OS X if you want to sell your Mac. OS X and macOS is not tied to your AppleID. Follow the steps in this article and create your own install USB boot disk of any version of OS X (Lion or later), preferably the latest version at the time you sell your Mac.
Boot your Mac from the USB disk and use Disk Utility to erase the hard drive. Then re-install OS X (macOS) from the boot disk.
After the installation is completed and you are greeted with the initial welcome screen, press Command-Q to quit the setup program. You will get the option to shut down the Mac. Shut down your Mac and remove the USB flash drive. The next time the Mac boots up, it will start from the setup utility as if it were a brand-new Mac and the new owner can enter their AppleID.
There is no upgrade to buy since OS X is now free. I just did this procedure with an iMac Retina 27' (2014). However, I had to create a boot disk with the latest version of Yosemite in order to use the old-style Disk Utility program so I could zero out the data when I erased the fusion drive. The El Capitan version would not give me the Security Options to select zero out data for the fusion drive. After the drive was zeroed out, I created the boot disk again using macOS Sierra and did the clean install.
You can also use an 8GB SD card too, for any Mac that includes an SD slot (most of them do that support macOS Sierra). Apple included the 'createinstallmedia' utility with OS X Mavericks and later. So all you have to do is copy and paste the terminal command and you are good to go. You don't have to wait for some developer to update their program when the terminal command works every time. Does this work with older macbooks? I think i tried to update my 2010 macbook pro with a SD card to do a clean install and it didn't work. I had to use an USB stick instead.
Installations typically do not work with SD cards because they are connected differently in a way that the computer can't boot from them. Same thing on PC as well, unless you use a USB SD card reader.
All SD slots in Macs are on the USB bus. I have installed OS X El Capitan using an SD card with a Mid-2009 MacBook Pro 13' model using an 8GB SanDisk Ultra SDHC Card.
The card was formatted GPT and OS X Extended (Journaled) and the boot disk was created using the Terminal command. Hold option on restart and choose the SD card as the boot disk and it boots from the SD card. Ah, in that case that guy must've been using an improperly formatted card or something.