I have been using nano a lot recently to code on Python. I have been flying by on it all until this little stump, no color... it makes it harder to know if you got the syntax right and harder to code! I'm not the best at code so please be nice and use step by step guide.

  • IMO Sublime Text is a much better way to go! – user3439894 Apr 20 '16 at 18:54
  • An IDE or better text editor might be a good idea. – JMY1000 Apr 20 '16 at 19:07

Nano is perfectly fine as a simple code editor. It has wonderful syntax highlighting. You will probably want an up-to-date version of nano.

  1. Install homebrew: https://brew.sh/
  2. Install nano: brew install nano
  3. Add this line to ~/.nanorc. That directory has all the syntax highlighting definition files.

    include "/usr/local/share/nano/*.nanorc"
  • what if I don't have the folder /usr/local/share/nano/ – Dr_Hope Oct 8 '20 at 21:02

It seems like the default version of nano included with OS X is very basic; it may not support syntax highlighting.

(source: https://gist.github.com/BlakeGardner/5587269)

You could try installing an updated version of nano using homebrew and then find instructions for enabling colors.

See also this stack overflow answer regarding installing updated nano.

Alternatively, you could also try a different editor such as TextMate, Emacs, or Vim. These editors will have additional convenience features like auto indentation.

  • I went and used macports to install one, ill try to use homebrew or git. – gidoBOSSftw5731 Apr 20 '16 at 18:57
  • and good job sighting your sources – gidoBOSSftw5731 Apr 20 '16 at 18:59
  • THis is for c, i need python – gidoBOSSftw5731 Apr 20 '16 at 19:04
  • After updating to a newer nano, in /usr/local/share/nano/, you'll have various *.nanorc files. All you have to do is have a ~/.nanorc file with include /usr/local/share/nano/python.nanorc – bernie Apr 20 '16 at 19:21

You cannot easily "update and use color" on OS X using nano, so use an alternative text editor, Sublime text is a good shout.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .