- How to merge hundreds of CSV files into one — free, using Terminal
- The exact copy-paste commands (no paid software needed)
- How to split a huge CSV file into smaller chunks
- How to remove duplicate rows after merging
- How to avoid the common “rows run together” problem
Want an easy, free way to merge multiple CSV files on your MacBook Pro or other Apple laptop? I’ll also show you how to split huge CSV files into smaller chunks for easy upload to a database or other tool.
A while back I found myself with 254 separate CSV files that I needed to merge into one, so I could upload the list to my email marketing platform. Uploading all 254 files one at a time would have been a nightmare.

There are plenty of paid apps that merge CSV files for you — but I didn’t want to pay for something your Mac can already do for free in about a minute. Below are the exact steps and commands, followed by the video walkthrough.
How to Merge Multiple CSV Files on a Mac (Free)
The whole thing runs in Terminal, the free command-line app already built into every Mac. Here are the four steps:
- Put every CSV you want to merge into one folder. Move all the files into a single new folder (for example, one on your Desktop called
csvfiles). Make sure only the CSVs you want to combine are inside it. - Open Terminal. Press
Command + Spacebar, type “Terminal,” and hit Enter. - Navigate into your folder. Type
cd(which stands for “change directory”), a space, then drag the folder from Finder onto the Terminal window — it fills in the path automatically — and press Enter. For example:cd ~/Desktop/csvfiles - Merge them with one command. Paste the command below and press Enter. It combines every
.csvin the folder into a single new file calledmerged.csv:
cat *.csv > merged.csv
That’s it. You’ll find merged.csv inside the same folder, containing all the rows from every file combined. It handles hundreds of files just as easily as a handful.
- Rows running together? If the last row of one file and the first row of the next end up on the same line, it’s because a file was missing a final line break. Opening
merged.csvin a text editor and re-saving usually fixes it, or make sure each source file ends with a blank line before merging. - Want to remove duplicate rows? After merging, open
merged.csvin a text editor with a “remove duplicate lines” feature (BBEdit is a popular free Mac option), or runsort merged.csv | uniq > deduped.csvin Terminal to create a duplicate-free copy.
Video Tutorial: Merging Multiple CSV Files Into One
Want the commands in a handy reference? Here’s a free cheat sheet you can copy to your own Google Drive.
How to Split a Big CSV File on a Mac (Free)
The opposite problem is just as common. I once had a client project that required cleaning a 100 MB CSV to import into a database — and the import needed the data broken into smaller chunks. Here’s how to split a huge CSV into smaller files, again using Terminal (navigate into the file’s folder with cd first, just like above).
Split the large file into roughly 1 MB pieces:
split -b 1m yourfile.csv
(Replace yourfile.csv with your actual filename. Change 1m to 5m for 5 MB pieces, and so on.)
Then add the .csv extension back onto each new piece:
for i in *; do mv "$i" "$i.csv"; done
Run that second command in a folder that contains only the split pieces, so it doesn’t rename anything you want to keep.
If you’d rather open and clean your CSVs in a spreadsheet without paying for Excel, LibreOffice (libreoffice.org) is a free, actively maintained option that works much like Excel. Google Sheets is another free choice that runs right in your browser.
Give it a try, and let me know how it works for you in the comments — along with any tips or questions you have.
Working with large customer lists and data as you grow your business? If you’d like help turning that data into more sales, book a free 30-minute call with me here.

Nicole Maxino says
Is there a way to eliminate duplicate entries when merging files?
Trent Jessee says
yes, you would simply use the remove duplicate function inside of the text editor you are using. I personally use Text Wrangler to do that after I merge the files. Great question :-)
Aidan Walker says
Hi,
great video easy to follow and understand.
I have a question, that’s not related to the video per se but does relate to downloading .csv files to my mac book pro.
I am currently studying a free online edX course using my mac book pro and it seems it is more geared to those with windows when it comes to downloading .csv files. I am struggling to download three .csv files for the coursework to save and the load to R. When I click on the links to each .csv file they just open to a safari window but don’t actually download so I can’t save them to the coursework file to later retrieve. Any idea how I can do this.
Trent Jessee says
Hi Aidan,
Great questions. I personally use OpenOffice which is free to use. Just go to openoffice.org and download the software. It’s similiar to Excel. Or you can use Google Docs which is also free.
Regards,
Trent
businessenglishtutors says
Hey Trent,
Your method worked! Thanks so much! :-)
Andrew
Trent Jessee says
Glad it help out Andrew!
Thanks
Trent
Holger Raddatz says
First of all, thank you very much for this description.
However, a problem arises for me when using it.
I have customer data in .csv files consisting of last name, first name, street, phone number, etc. The individual details are separated by a comma. The data is meant to be imported into Excel and I use the commas to map the columns there.
After the last entry in each individual csv. file is of course no comma.
If I use the method you mentioned to import several of the csv. files. Files together, the first entry of the second file is added after the last entry of the first file … the first entry of the third file with the last entry of the second file, etc.
Is there a command I can add in terminal that when merging the files a comma is added to the end of each file?
Watchman Advisors says
That’s a great question Holger! I don’t know of the command off the top of my head to use for that but you can probably find out online, sorry.
James says
Great step-by-step…worked flawlessly…only question I have is that in the video you said you would have a cheatsheet to download with your steps and I didn’t see one 🤷🏻♂️…oh and BTW, “cd” stands for ‘change directory’ which is the command it is giving the computer OS 😊.
Watchman Advisors says
Thank you James. And here is the cheat sheet you can make a copy of:
https://docs.google.com/document/d/1w2ijSkg0KX0tsvzZbktFadgdNrjXECiR46OtuiPhZ1k/edit?usp=sharing