Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'd like to install a binary for only my user, because I don't have root, and therefore don't have access to /usr/bin. I've tried ~/bin, and it can't find the binary. I'm on Mac OS 10.6.7. Is there any other binary folder that can usually be user-modified, or any way to get it to recognize ~/bin?

My .profile:

# Setting PATH for Python 2.7
# The orginal version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

A user's BASH environment variables can be defined in ~/.profile. Add a line to this file:

export PATH=$PATH:~/bin

To read the new PATH variable now:

. ~/.profile

or

source ~/.profile

(The . and source are synonyms.)

Then to see that the PATH variable was updated:

echo $PATH

Update

I have never seen {} in a PATH environment variable?

PATH="$PATH:/Library/Frameworks/Python.framework/Versions/2.7/bin:~/bin"
export $PATH

Or create a text file containing a path in /etc/paths.d/ so all shells and users get the path...

echo "~/bin/" > /etc/paths.d/home
share|improve this answer
    
So you can add ~/bin (or preferably ~/.bin) to the list of places that it looks for binaries in? –  tkbx Jan 19 '13 at 17:26
1  
@tkbx that is what he is doin here. I don't think ~/.bin is preferable, as ~/bin is fairly standard and even configured by default in some operating systems. –  jordanm Jan 19 '13 at 17:48
    
@tkbx The Mac is Darwin Unix, and the way to make a hidden file or directory in *nix is to start the name with a "dot", so ~/.bin/ creates a hidden directory. It would work either way, but ~/bin/ is normal. –  Christopher Jan 19 '13 at 17:56
    
@Christopher I've edited my answer to show my .profile. How can I modify this to add ~/bin without breaking whatever is already there? –  tkbx Jan 22 '13 at 19:27
    
@tkbx Updated. :) I think you have to log out and in again to use the /etc/paths.d/ method. –  Christopher Jan 22 '13 at 19:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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