How to Use Terminal to Convert Audio Files to Ringtones in OS X

Most of you will have a number of songs in your iTunes library, and chances are some will have hundreds and thousands of songs in their library. You might also like a sound bite or two and would like to use them as a ringtone for your phone. While there are a number of third-party apps that’ll let you do this, your simplest option is to use a utility available in OS X’s Terminal to convert audio files to ringtones for your iOS device.

This particular utility is called “afconvert” and has been included in OS X since 2003. “afconvert” stands for “Audio File Convert,” and as the name suggests, it lets you convert one audio file to another format. This utility also lets you perform a number of other actions on audio files such as managing quality settings, extracting channels, managing bitrates and the sort.

To get started, simply type in the terminal:

afconvert -hf

This will display a list of the audio file formats supported by this utility. One of these formats is the format that is used for ringtones, which is m4r (Mpeg-4 Ringtone).

Covert-Audio-Files-Terminal-Full-list-formats

To start, drag your audio file to some handy location such as the Desktop. Make sure the file is cropped to the length you want it. Once your file is prepared, open Terminal from the Spotlight and perform the following steps:

1. Enter the following command in Terminal, followed by a single space (do not press Enter yet):

afconvert -f m4af

Covert-Audio-Files-Terminal-Main-command-Terminal

2. Drag the audio file from its location to Terminal, and you’ll see a full path to the file appear, similar to the screenshot below:

Covert-Audio-Files-Terminal-First-Drag

Covert-Audio-Files-Terminal-First-command

3. Now drag the file to Terminal again, which will result in entering another full path to it. But in this new path, delete the filename suffix (.mp3, .aac etc.) and replace it with “.m4r”. The full command will look something similar to the one below:

Covert-Audio-Files-Terminal-m4r-command

4. Press Enter to execute the command, and a new file with the .m4r format will be placed in the same location as the original.

Covert-Audio-Files-Terminal-Both-files

Once this whole procedure is finished, simply drag the new .m4r file into iTunes or import it into your library. It should now show up in the ringtones section of your iTunes library. From here you can sync it with your iPhone or iPad.

On your iPhone/iPad, simply navigate to “Settings -> Sounds” to use this ringtone for various notifications.