Search code examples
pythonmacosbashterminalenthought

OSX: Setting Enthought python path in .bash_profile results in weird terminal behavior


I followed the knowledge base on adding this to the .bash_profile

PATH="~/Library/Enthought/Canopy_64bit/User/bin"
export PATH

When I then restart the Terminal, a lot of functions do not work anymore:

X:~ excuvator$ ls
-bash: ls: command not found
X:~ excuvator$ security
-bash: security: command not found
X:~ excuvator$ sudo
-bash: sudo: command not found

However, enpkg and cd still seem to be callable. If I remove that part, stuff works again. Does anyone have any insight to what is happening? I just want to get enpkg running...


Solution

  • You reset PATH, rather than adding to it, so bash doesn't know any place to look for commands other than the single directory you specified. Instead, use one of

    PATH=$PATH:~/Library/Enthought/Canopy_64bit/User/bin
    

    or

    PATH=~/Library/Enthought/Canopy_64bit/User/bin:$PATH
    

    Which of the two assignments you use depends on whether whether you want the new directory to be the first or last place the shell looks for a named command.

    enpkg actually is in that directory, and cd is a shell built-in command, not an external program, so no path lookup is involved.