How to Split Files on Mac
Posted July 9, 2023 at 7:28pm by iClarified
These are instructions on how to split a file into smaller files on Mac. You may need to do this if you have a large file that needs to be copied to a volume that does not support it. For example, if you want to save a 5GB file on a FAT32 volume that is limited to files up to 4GB in size.
Open Terminal from your Dock or from the Applications > Utilities folder.
To split a file, we will use the aptly named split command. Power users may be familiar with the tool. It's free and easy enough for anyone to use.
The basic syntax is as follows:
split -b byte_count[K|k|M|m|G|g] [file] [prefix]
● Replace 'byte_count[K|k|M|m|G|g]' with the chunk size you'd like. For example, 1G for 1 gigabyte chunks or 1000M for chunks that are 1000 megabytes in size.
● Replace [file] with the path to the file you'd like to split. To do this easily, drag and drop the file into the Terminal window to copy its path into the command line.
● Replace [prefix] with the path prefix to your chunked file names. For example, if you would like to split a large zip file, you may want a prefix of '/path/filename.zip.' which will result in chunks of 'filename.zip.aa', 'filename.zip.ab', and so on.
Here's a sample command we used for splitting a large video clip:
split -b 1G /Users/iClarified/Desktop/IMG_0192.MOV /Users/iClarified/Desktop/IMG_0192.MOV.
This split the IMG_0192.MOV file into multiple parts. ie IMG_0192.MOV.aa, IMG_0192.MOV.ab, IMG_0192.MOV.ac, IMG_0192.MOV.ad, IMG_0192.MOV.ae
After splitting a file, you may want to combine the smaller chunks back into a large file. Here's how.
Open Terminal from your Dock or from the Applications > Utilities folder.
To combine multiple files together, use the following command:
cat file.ext.* > file.ext
Replace file.ext with your original filename from the previous steps.
The cat command can be used to combine files with unique names as well.
For example:
cat filename1.ext filename2.ext filename3.ext > filename.txt
After splitting and combining files you may want to confirm that the combined file is the same as the original. This is especially important with a zip file and other files that will not open if they are incomplete. To do so, generate the md5 hash of the original file and compare it to the md5 hash of the combined file. You can do this with the md5 command line tool in Terminal.
md5 [filename]
For example:
md5 /Users/iClarified/Desktop/IMG_0192-Original.MOV
Results in the following hash:
MD5 (/Users/iClarified/Desktop/IMG_0192-Original.MOV) = 9de324ae096ecfe4be4ca0f672a4bbc9
Comparing that to the md5 hash of the combined file we can confirm they are both the identical.
These instructions will work with a zip file, pdf file, csv file, and any other file type you may have to split. If you have any other questions, please let us know in the comments!
HOW TO SPLIT FILES ON MAC USING TERMINAL
Step One
Open Terminal from your Dock or from the Applications > Utilities folder.
Step Two
To split a file, we will use the aptly named split command. Power users may be familiar with the tool. It's free and easy enough for anyone to use.
The basic syntax is as follows:
split -b byte_count[K|k|M|m|G|g] [file] [prefix]
● Replace 'byte_count[K|k|M|m|G|g]' with the chunk size you'd like. For example, 1G for 1 gigabyte chunks or 1000M for chunks that are 1000 megabytes in size.
● Replace [file] with the path to the file you'd like to split. To do this easily, drag and drop the file into the Terminal window to copy its path into the command line.
● Replace [prefix] with the path prefix to your chunked file names. For example, if you would like to split a large zip file, you may want a prefix of '/path/filename.zip.' which will result in chunks of 'filename.zip.aa', 'filename.zip.ab', and so on.
Here's a sample command we used for splitting a large video clip:
split -b 1G /Users/iClarified/Desktop/IMG_0192.MOV /Users/iClarified/Desktop/IMG_0192.MOV.
This split the IMG_0192.MOV file into multiple parts. ie IMG_0192.MOV.aa, IMG_0192.MOV.ab, IMG_0192.MOV.ac, IMG_0192.MOV.ad, IMG_0192.MOV.ae
HOW TO COMBINE SPLIT FILES ON MAC
After splitting a file, you may want to combine the smaller chunks back into a large file. Here's how.
Step One
Open Terminal from your Dock or from the Applications > Utilities folder.
Step Two
To combine multiple files together, use the following command:
cat file.ext.* > file.ext
Replace file.ext with your original filename from the previous steps.
Step Three
The cat command can be used to combine files with unique names as well.
For example:
cat filename1.ext filename2.ext filename3.ext > filename.txt
IMPORTANT NOTES
After splitting and combining files you may want to confirm that the combined file is the same as the original. This is especially important with a zip file and other files that will not open if they are incomplete. To do so, generate the md5 hash of the original file and compare it to the md5 hash of the combined file. You can do this with the md5 command line tool in Terminal.
md5 [filename]
For example:
md5 /Users/iClarified/Desktop/IMG_0192-Original.MOV
Results in the following hash:
MD5 (/Users/iClarified/Desktop/IMG_0192-Original.MOV) = 9de324ae096ecfe4be4ca0f672a4bbc9
Comparing that to the md5 hash of the combined file we can confirm they are both the identical.
These instructions will work with a zip file, pdf file, csv file, and any other file type you may have to split. If you have any other questions, please let us know in the comments!