3 Replies Latest reply: Jan 26, 2011 6:38 AM by ruffyleaf
ruffyleaf Level 1 Level 1 (0 points)
Hello,

I'm having problems editing my $PATH variable.

I've created a ".profile" with this line

export /my_path:$PATH

But when I launch Terminal again, I get this error:

-bash: export: `/my_path:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin': not a valid identifier

Is there something that I am missing? Or is there another easier way to edit my $PATH variable?

Cheers!
Max

Macbook Pro 15", Mac OS X (10.6.6)
  • 1. Re: how to modify $PATH variable
    ajduguid Level 3 Level 3 (650 points)
    You forgot to tell the export command what variable you were wanting to set.

    export PATH=yourpathhere:$PATH
  • 2. Re: how to modify $PATH variable
    BobHarris Level 6 Level 6 (13,130 points)
    I'm having problems editing my $PATH variable.

    I've created a ".profile" with this line

    export /my_path:$PATH

    But when I launch Terminal again, I get this error:

    -bash: export: `/my_path:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin': not a valid identifier

    Is there something that I am missing? Or is there another easier way to edit my $PATH variable?


    export PATH="/my_path:$PATH"

    Also note, that bash will look for 1 of 3 initialization files

    .bash_profile
    .bash_login
    .profile

    In that order, and will use the first one it finds and then stop looking. If you also have a .bashrc file, you would source that in your shell initialization file

    source $HOME/.bashrc


    By the way, Terminal, Unix, and command line command questions are best asked in the Mac OS X Technologies > Unix Forum
    <http://discussions.apple.com/forum.jspa?forumID=735>
  • 3. Re: how to modify $PATH variable
    ruffyleaf Level 1 Level 1 (0 points)
    Thannks for the little pointers and heads up guys!!!