Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Update split for large file pieces (2GB+) UNIX
As described in this hint, the split utility is a highly-useful tool for splitting a large file into pieces. Recently, however, I discovered that attempting to split a file into pieces 2GB in size or larger fails with an error:
$ split -b 2048m somelargefile
split: write: Invalid argument
This is caused by Apple shipping an older copy of split that uses signed long values for the byte count, limiting it to 2047MB. One workaround is to compile a new split utility that uses 64-bit integers, allowing a much larger byte count. Newer source code may be found on the NetBSD web site.

To get the code to compile for Mac OS X, add the following line near the top of the split.c file, right among the other include statements:
#include <sys/stat.h>
This command can be then used to compile the source code:
cc -Os -o split split.c
Or use this command for a universal (PowerPC and Intel) binary:
cc -Os -isysroot /Developer/SDKs/MacOSX10.4u.sdk 
-arch i386 -arch ppc -o split split.c
The new split executable can then be installed with the commands listed below (the $ is the command prompt; don't copy and paste it). Notice that the Apple-provided split utility is renamed in case you need it in the future:
$ sudo mv /usr/bin/split /usr/bin/split.apple
$ sudo cp split /usr/bin/split
$ sudo chmod ugo-w /usr/bin/split
$ sudo chmod ugo+rx /usr/bin/split
$ sudo chown root:wheel /usr/bin/split
[robg adds: I tried this on my Intel Mac, compiling a Universal binary, and it worked fine. You'll need the Developer Tools installed to do this.]
    •    
  • Currently 3.13 / 5
  You rated: 2 / 5 (8 votes cast)
 
[36,297 views]  

10.4: Update split for large file pieces (2GB+) | 2 comments | Create New Account
Click here to return to the '10.4: Update split for large file pieces (2GB+)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Update split for large file pieces (2GB+)
Authored by: fracai on Nov 22, '06 08:11:14PM

you can also install the coreutils package with MacPorts to get version 5.97 of GNU Split, which also correctly handles splits greater than 2GB.

---
i am jack's amusing sig file



[ Reply to This | # ]
10.4: Update split for large file pieces (2GB+)
Authored by: ssevenup on Feb 14, '08 04:32:46PM

In the fink package manager this is in "coreutils-default". The fink version handles large file sizes.

---
Mark Moorcroft
ELORET Corp. - NASA/Ames RC
Sys. Admin.



[ Reply to This | # ]