Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

how to modify $PATH variable

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)

Posted on Jan 26, 2011 4:15 AM

Reply
Question marked as Best reply

Posted on Jan 26, 2011 6:20 AM

You forgot to tell the export command what variable you were wanting to set.

export PATH=your pathhere:$PATH
3 replies

Jan 26, 2011 6:20 AM in response to ruffyleaf

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>

how to modify $PATH variable

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.