Create Bootable USB disk of CentOS 7 in Mac OS x

To create USB bootable disk from centos 7 ISO file in MacOS we can follow the below simple steps.

Create the dmg image file using below command.

oel7-MacBook-Pro:~ admin$ hdiutil convert -format UDRW -o centos7.img /Users/admin/Downloads/CentOS-7-x86_64-DVD.iso
Reading Master Boot Record (MBR : 0)…
Reading CentOS 7 x86_64 (Apple_ISO : 1)…
Reading (Type EF : 2)…
Reading CentOS 7 x86_64 (Apple_ISO : 3)…
....................................................................................................................................................................................
Elapsed Time: 16.127s
Speed: 256.1Mbytes/sec
Savings: 0.0%
created: /Users/admin/centos7.img.dmg

List the created file

oel7-MacBook-Pro:~ admin$ ls -lthr centos7.img.dmg
-rw-r--r-- 1 admin staff 4.0G Apr 22 14:17 centos7.img.dmg
oel7-MacBook-Pro:~ admin$

List the available local and USB disks.

oel7-MacBook-Pro:~ admin$ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage Macintosh HD 250.1 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1 (internal, virtual):
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Macintosh HD +249.8 GB disk1
Logical Volume on disk0s2
5FA6060B-8356-4848-9E01-EDDD5D017AD4
Unencrypted
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *7.7 GB disk2
1: 0xEF 6.4 MB disk2s2
oel7-MacBook-Pro:~ admin$

Partition the USB disk by finding the right disk.

oel7-MacBook-Pro:~ admin$ diskutil partitionDisk /dev/disk2 1 "Free Space" "unused" "100%"
Started partitioning on disk2
Unmounting disk
[ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ]
Creating the partition map
Waiting for partitions to activate
Finished partitioning on disk2
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *7.7 GB disk2
1: EFI EFI 209.7 MB disk2s1
oel7-MacBook-Pro:~ admin$

Use DD command from dmg file to create the bootable disk, this operation will take more than 30 min to 1 hour for 4 GB ISO file.
It may complete less than above mentioned time if we are using an USB 3.0 sticks.

oel7-MacBook-Pro:~ admin$ sudo dd if=centos7.img.dmg of=/dev/disk2 bs=1m
Password:
4130+1 records in
4130+1 records out
4330866688 bytes transferred in 3432.114984 secs (1261865 bytes/sec)
oel7-MacBook-Pro:~ admin$

Once done disk will be ejected automatically, If not we can use below command to eject the USB stick.

oel7-MacBook-Pro:~ admin$ diskutil eject /dev/disk2

Using default utilities in MacOS we can create a bootable disk without using any third party tools.