Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have added .bash_profile, .bashrc, .profile exeuctables in the /var/root dir. However, unlike the normal users which execute their .bash_profile(s) and change the path. There is no difference in the profiles but the root user one does not work.

I am unclear about how to get this workinkg. Any suggestions? Thanks.

share|improve this question
2  
Generally, one doesn't use the root user in Mac OS X; the "Mac way" is to use sudo. –  Daniel Lawson Apr 5 '12 at 3:33
add comment

4 Answers 4

up vote 2 down vote accepted

Try adding the path in ~/.profile

share|improve this answer
add comment

For system wide changes (including root user) you have to edit /etc/profile or /etc/bashrc.

share|improve this answer
add comment

To get to root I find it helpful to use:

sudo su -

This is a login shell, it runs root's dotfiles and sets up whatever environment you want root to have.

However, this will leave $LOGNAME as your logged in user.

To get a full login shell, as if you logged into the console as root:

login -fp root

Also, if you, like me, use root a lot, you can set that login command in your terminal. In iTerm I have a root visor and window where I login as root.

Why?

  • using sudo litters my homedir with root owned files. I trip over them,

  • sudo bash or sudo zsh make me root but with my mortal environment. This is not what I want. I want separation.

  • Convenience. There are lots of things that root sees that admin users do not.

Chiggsy works in his homedir.

Root works on the system.

man login
share|improve this answer
add comment

If you're using Mac OS X 10.7 or 10.8 you can create a /etc/launchd.conf file and add your variables as is :

setenv PATH /bin:/usr/bin:/Applications/Myapp.app/Contents/bin

and reboot

share|improve this answer
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.