You may use the free jhead (which itself uses jpegtran).
To fix a picture named "image.jpg" just type :
jhead -autorot image.jpg
To fix all JPGs having EXIF data in the current folder use :
jhead -autorot *.jpg
If once rotated the thumbnail icons do not show correctly, you could refresh them by :
- Create a new folder (keep the untitled name)
- Move the affected images into the folder
- Using Column View, move the images back into the original folder
- Delete the empty untitled folder