At the moment i'm on Mavericks, and i just uninstalled homebrew. With homebrew i had installed python, but after uninstalling it my terminal can't start the python interpreter. I receive this message:

-bash: /usr/local/bin/python: No such file or directory

There is some kind of configuration that i have to restore for execute the native version of python?


Restarting Terminal will probably do the trick.

  • It worked! To uninstall homebrew i've runned this file (gist.github.com/mxcl/1173223), is the correct way to remove it? – g_rmz Jun 17 '14 at 17:46
  • @g_rmz: Yeah, but your shell caches paths to executables for a period of time. Restarting it clears that. – mipadi Jun 17 '14 at 17:52

Simple answer: You could run hash -r, which would cause bash (your shell) to forget the locations of the executables, and "re-search" for them in $PATH.

More in-depth answer: By default, bash stores commands and their locations in a table (hash). It then only needs to search $PATH once per command, and search the table for each time you run the command again.
Restarting bash will clear the hash table, but if you don't want to restart it, hash -r (to clear the table) or hash -p commandname (to clear just one entry) will work.

  • So at this point i don't have to run hash -r, do i? – g_rmz Jun 17 '14 at 18:04
  • @g_rmz Correct. This is another way of doing the same thing. (But what if you had a bunch of environment variables and aliases set up for the session? Would you want to restart?) – BenjiWiebe Jun 17 '14 at 18:07
  • Very thanks for the clarification! – g_rmz Jun 17 '14 at 18:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.