Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an administrator account on my OS X Lion 10.7.2. I have installed a few applications through this account, but I am not able to run them without sudo. For example, I installed git and I cannot just simply run git from the terminal as I get

-bash: git: command not found

Instead I need to run sudo git.

I have similar issues with other applications. Another one that is not working is MacFusion.app that tries to use /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources/sshfs-static. I tried running sshfs-static from the terminal, but once again I had to sudo to make it work.

Any suggestions?

share|improve this question
    
I used git-osx-installer that I downloaded from code.google.com/p/git-osx-installer/downloads/list?can=3 . I checked my PATH and /usr/local/git/bin is in it. –  liutikas Mar 20 '12 at 13:14
    
I checked my path without sudo. I did echo $PATH –  liutikas Mar 20 '12 at 13:22
    
Add PATH=/usr/local/git/bin:$PATH to your ~/.bash_profile and check that the git binary file has correct permissions (execute set). –  slhck Mar 20 '12 at 13:26
    
I just found out that I cannot even ls /usr/local without sudo. How do I fix that? All the directories there have been set to root as user and wheel as group. –  liutikas Mar 20 '12 at 13:31
    
Then try sudo chown -R $(whoami) /usr/local. It's not a system folder anyway, so it's better to keep it owned by you. –  slhck Mar 20 '12 at 13:34

1 Answer 1

up vote 8 down vote accepted

/usr/local is not used on a default installation of OS X and typically is owned by your user, since you will create it and populate it. The popular package manager Homebrew will set the permissions and use it without ever needing root permissions.

If it's owned by root, and missing execute/read permissions for your user, then the commands in /usr/local/bin (or /usr/local/git/bin) will only work when called with sudo.

To fix this, take ownership of /usr/local again:

sudo chown -R $(whoami) /usr/local

As for why this happened, I can only guess that the git-osx-installer reset the permissions of /usr/local to something more restrictive. Some bug reports mention that.

share|improve this answer

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.