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.

  • 2
    Generally, one doesn't use the root user in Mac OS X; the "Mac way" is to use sudo. – Daniel Apr 5 '12 at 3:33

Try adding the path in ~/.profile

| improve this answer | |

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.


  • 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
| improve this answer | |

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

| improve this answer | |

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

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .