Sites that sell lossless usually offer only FLAC files. To convert to ALAC for iTunes and iDevices using ffmpeg:
for f in `ls *.flac`; do ffmpeg -i $f -c alac ${f/flac/m4a}; done
This assumes the current directory is the directory containing the FLAC files.
Explanation:
- For all .flac files
- Call ffmpeg with the original file as input (-i $f)
- Use the ALAC codec (-c alac)
- Name the output file the same as the input file but with a m4a extension (${f/flac/m4a})
More on for loops in bash from the OS X command line.