Basically I was just trying to set up a PATH environment variable that pointed to the /bin directory inside the main Java directory.

I did this by doing: sudo nano /etc/paths.

But then couldn't get the path to save so got frustrated and just did some keyboard bashing... Which then closed the sudo nano path.

And now nothing is working. No bash commands, etc. I have tried restarting several times and every time I open terminal I get the following message:

Last login: Tue Jan 7 08:41:08 on ttys000 Fatal Python error: initfsencoding: unable to load the file system codec LookupError: no codec search functions registered: can't find encoding

using OSX on Maxbook

Please help..

  • You can use absolute paths, when you execute commands: /usr/bin/sudo /usr/bin/nano /etc/paths. Jan 7, 2020 at 11:45

1 Answer 1


Not knowing anything about the content of your /etc/paths file I would suggest you locate a known-good /etc/paths file (from a working Mac I suppose) and re-edit yours to match. If that works you can again attempt to make the change you need if editing your /etc/paths file is really the best solution for doing so.

(My Ubuntu machine has no /etc/paths file so that could be unique to Mac or due to the fact that Mac uses a very old bash or... )

My Mac /etc/paths:

$ cat /etc/paths 

(Also, to save in nano it's ctrl-o (write Out) and to quit is ctrl-x. You will want to sudo nano /etc/paths or you won't be able to save.)

You must log in to answer this question.

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