I have finally started learning LaTeX today and I am loving it. It is so much fun. On Mac, to run the LaTeX software, you can download the MacTeX distribution from the site which comes with three different packages. You can use the GUI tool to process the LaTeX file. But if you want to use the other editors and would like to run it through the terminal, then we have to do an additional step to make things work from the Terminal.
Adding the texbin to the $PATH variable makes the magic. One has to append the /usr/texbin to the $PATH variable. To do this, open the .bash_profile file and add the above path to the existing $PATH variable and save the file. Run source ~/.bash_profile to make the changes immediately.
Bingo, now you can run the latex or pdftex command in the terminal and process your LaTeX files.