I'm using LaTeX on a Mac. The editor I use is Textmate 2.
When I hit "typeset & view", what I get is something like
! LaTeX Error: File 'xy.sty' not found.
However, if I do pdflatex abc.tex from the command line, everything works fine.
From the information provided by pdfLaTeX, I noticed that the only .sty files that can be found are in the folder
/usr/local/texlive/2012/texmf-dist/tex/latex/base/, while the other packages are in places like /usr/local/texlive/2012/texmf-dist/tex/generic/.
That seems to cause the problem. I don't want to shuffle .sty files among folders. Can I make things work by changing some settings? Like can I let the compiler know to look for some .sty files in some other folders under /usr/local/texlive/2012/texmf-dist/?

abc.texfirst from the Terminal and then from TextMate; for both cases, add here the 20 lines of the log file. – egreg Feb 8 at 18:53