Skip to content

Instantly share code, notes, and snippets.

@mamiu
Last active October 11, 2021 09:54
Show Gist options
  • Select an option

  • Save mamiu/a62086858a78441895d0953b17617e2b to your computer and use it in GitHub Desktop.

Select an option

Save mamiu/a62086858a78441895d0953b17617e2b to your computer and use it in GitHub Desktop.

Revisions

  1. mamiu revised this gist Oct 11, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions macos_bootable_usb_stick_guide.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    ## Create bootable USB stick from an ISO image on macOS

    > If you want to create a bootable USB stick for Windows (Windows 10/11 installation media) have a look at [this guide](https://www.freecodecamp.org/news/how-make-a-windows-10-usb-using-your-mac-build-a-bootable-iso-from-your-macs-terminal/).
    1. Download the desired ISO file

    2. Open a terminal application (like the Apple Terminal or iTerm)
  2. mamiu revised this gist Oct 11, 2021. 1 changed file with 3 additions and 15 deletions.
    18 changes: 3 additions & 15 deletions macos_bootable_usb_stick_guide.md
    Original file line number Diff line number Diff line change
    @@ -34,19 +34,7 @@ diskutil list
    diskutil unmountDisk /dev/diskN
    ```

    8. Format the disk

    ```
    diskutil eraseDisk MS-DOS "NAME" GPT /dev/diskN
    ```

    9. Unmount the disk again

    ```
    diskutil unmountDisk /dev/diskN
    ```

    10. Burn the `.dmg` image to the flask disk. Replace `/path/to/converted-iso.dmg` with the path where the converted ISO image file is located (e.g. `~/Downloads/ubuntu.dmg`).
    8. Burn the `.dmg` image to the flask disk. Replace `/path/to/converted-iso.dmg` with the path where the converted ISO image file is located (e.g. `~/Downloads/ubuntu.dmg`).

    ```
    sudo dd if=/path/to/converted-iso.dmg of=/dev/rdiskN bs=1m status=progress
    @@ -56,10 +44,10 @@ sudo dd if=/path/to/converted-iso.dmg of=/dev/rdiskN bs=1m status=progress
    > Note: Using `/dev/rdisk` instead of `/dev/disk` may be faster.
    11. Eject the flash disk and remove it when the command completes
    9. Eject the flash disk and remove it when the command completes

    ```
    diskutil eject /dev/diskN
    ```

    12. Now the USB stick is ready. You can boot any device from it by plugging it in, start the device, change the boot order in the BIOS or open the boot device menu and select the USB stick.
    10. Now the USB stick is ready. You can boot any device from it by plugging it in, start the device, change the boot order in the BIOS or open the boot device menu and select the USB stick.
  3. mamiu revised this gist Oct 1, 2021. 1 changed file with 22 additions and 3 deletions.
    25 changes: 22 additions & 3 deletions macos_bootable_usb_stick_guide.md
    Original file line number Diff line number Diff line change
    @@ -1,36 +1,53 @@
    ## Create bootable USB stick from an ISO image on macOS

    1. Download the desired ISO file

    2. Open a terminal application (like the Apple Terminal or iTerm)

    3. Convert the `.iso` image to a `.dmg` file ([UDIF](https://en.wikipedia.org/wiki/Apple_Disk_Image#:~:text=formats%2C%20including%20the-,Universal%20Disk%20Image%20Format%20(UDIF),-from%20Mac%20OS) image) using the [convert](https://ss64.com/osx/hdiutil.html#:~:text=convert%20image%20-format%20format%20-o%20outfile,%20write%20the%20result%20to%20outfile.) option of hdiutil:

    ```
    hdiutil convert -format UDRW -o /path/to/target /path/to/source.iso
    ```

    > **hdiutil** will put the `.dmg` file extension to the output file automatically.
    4. Get the current list of devices

    ```
    diskutil list
    ```
    5. Insert your flash media
    6. Run the command from step **4** again to determine the device node assigned to your flash media (e.g. `/dev/disk2`)

    5. Insert your USB stick

    6. Run the command from step **4** again to determine the device disk assigned to your USB stick (e.g. `/dev/disk2`)

    ```
    diskutil list
    ```

    7. Unmount that disk

    > Note: In the next commands you have to replace `N` with the disk number you've determined in the last command (in the previous example, `N` would be `2`).
    ```
    diskutil unmountDisk /dev/diskN
    ```

    8. Format the disk

    ```
    diskutil eraseDisk MS-DOS "NAME" GPT /dev/diskN
    ```

    9. Unmount the disk again

    ```
    diskutil unmountDisk /dev/diskN
    ```

    10. Burn the `.dmg` image to the flask disk. Replace `/path/to/converted-iso.dmg` with the path where the converted ISO image file is located (e.g. `~/Downloads/ubuntu.dmg`).

    ```
    sudo dd if=/path/to/converted-iso.dmg of=/dev/rdiskN bs=1m status=progress
    ```
    @@ -39,8 +56,10 @@ sudo dd if=/path/to/converted-iso.dmg of=/dev/rdiskN bs=1m status=progress
    > Note: Using `/dev/rdisk` instead of `/dev/disk` may be faster.
    11. Eject the flash disk remove your flash media when the command completes
    11. Eject the flash disk and remove it when the command completes

    ```
    diskutil eject /dev/diskN
    ```

    12. Now the USB stick is ready. You can boot any device from it by plugging it in, start the device, change the boot order in the BIOS or open the boot device menu and select the USB stick.
  4. mamiu revised this gist Oct 1, 2021. No changes.
  5. mamiu revised this gist Oct 1, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions macos_bootable_usb_stick_guide.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    ## Create bootable USB stick from an ISO file on an Apple macOS
    ## Create bootable USB stick from an ISO image on macOS

    1. Download the desired ISO file
    2. Open a terminal application (like the Apple Terminal or iTerm)
    3. Convert the `.iso` image to a `.dmg` file ([UDIF](https://en.wikipedia.org/wiki/Apple_Disk_Image#:~:text=formats%2C%20including%20the-,Universal%20Disk%20Image%20Format%20(UDIF),-from%20Mac%20OS) image) using the convert option of hdiutil:
    3. Convert the `.iso` image to a `.dmg` file ([UDIF](https://en.wikipedia.org/wiki/Apple_Disk_Image#:~:text=formats%2C%20including%20the-,Universal%20Disk%20Image%20Format%20(UDIF),-from%20Mac%20OS) image) using the [convert](https://ss64.com/osx/hdiutil.html#:~:text=convert%20image%20-format%20format%20-o%20outfile,%20write%20the%20result%20to%20outfile.) option of hdiutil:
    ```
    hdiutil convert -format UDRW -o /path/to/target /path/to/source.iso
    ```
  6. mamiu created this gist Oct 1, 2021.
    46 changes: 46 additions & 0 deletions macos_bootable_usb_stick_guide.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    ## Create bootable USB stick from an ISO file on an Apple macOS

    1. Download the desired ISO file
    2. Open a terminal application (like the Apple Terminal or iTerm)
    3. Convert the `.iso` image to a `.dmg` file ([UDIF](https://en.wikipedia.org/wiki/Apple_Disk_Image#:~:text=formats%2C%20including%20the-,Universal%20Disk%20Image%20Format%20(UDIF),-from%20Mac%20OS) image) using the convert option of hdiutil:
    ```
    hdiutil convert -format UDRW -o /path/to/target /path/to/source.iso
    ```
    > **hdiutil** will put the `.dmg` file extension to the output file automatically.
    4. Get the current list of devices
    ```
    diskutil list
    ```
    5. Insert your flash media
    6. Run the command from step **4** again to determine the device node assigned to your flash media (e.g. `/dev/disk2`)
    ```
    diskutil list
    ```
    7. Unmount that disk
    > Note: In the next commands you have to replace `N` with the disk number you've determined in the last command (in the previous example, `N` would be `2`).
    ```
    diskutil unmountDisk /dev/diskN
    ```
    8. Format the disk
    ```
    diskutil eraseDisk MS-DOS "NAME" GPT /dev/diskN
    ```
    9. Unmount the disk again
    ```
    diskutil unmountDisk /dev/diskN
    ```
    10. Burn the `.dmg` image to the flask disk. Replace `/path/to/converted-iso.dmg` with the path where the converted ISO image file is located (e.g. `~/Downloads/ubuntu.dmg`).
    ```
    sudo dd if=/path/to/converted-iso.dmg of=/dev/rdiskN bs=1m status=progress
    ```

    > Note: If you see the error `dd: Invalid number '1m'` you are using GNU dd. Use the same command but replace `bs=1m` with `bs=1M`.
    > Note: Using `/dev/rdisk` instead of `/dev/disk` may be faster.
    11. Eject the flash disk remove your flash media when the command completes
    ```
    diskutil eject /dev/diskN
    ```
    12. Now the USB stick is ready. You can boot any device from it by plugging it in, start the device, change the boot order in the BIOS or open the boot device menu and select the USB stick.