Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to turn on python syntax highlighting for Terminal.app on Mac OS X?

share|improve this question
    
Do you mean inside the Python read-eval-print interpreter? –  Lawrence Velázquez Mar 31 '10 at 5:38
add comment

3 Answers

If you just want to highlight sources you dump into the terminal a la cat try excellent pygments. It actually supports a lot of languages. Run with

pygmentize source.py

If instead you were talking about editing files with syntax highlighting inside a mac terminal, this really depends on the editor.

  • for vi or vim you want at least these option in ~/.vimrc

    syntax on
    
  • emacs works right out of the box

  • don't ask me about nano.
share|improve this answer
    
nanos teh shit man. the only of those i can actually use ;) –  Mark Mar 31 '10 at 3:38
    
include "/usr/share/nano/python.nanorc" - quite good. –  grawity Mar 31 '10 at 18:18
add comment

Try ipython. It highlights syntax and much more.
I haven't tried it on Mac but looks like it must work:
http://stackoverflow.com/questions/726449/installing-ipython-with-readline-on-the-mac

Another option is WxPython and pycrust (which works without Terminal.app :( )

share|improve this answer
add comment

Here is a series of screencasts, that shows bpython in action:

http://bpython-interpreter.org/screenshots/

share|improve this answer
    
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. –  Diogo Aug 9 '12 at 12:45
    
@Diogo, visiting the site will show that this link is to how-to videos. It's difficult to include essential parts in that respect. I agree that the answer needs work, but I don't think your comment is helpful. –  user3463 Aug 12 '12 at 5:41
    
No problem Randolph, this comment was automatically posted by the review system when I reviewed it. –  Diogo Aug 12 '12 at 14:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.