MacOS – What automatic script runs with Bourne Shell (/bin/sh) for root

bashcommand linemacosscript

I want to add some aliases to my OSX command line environment for easier navigation when in the root prompt (sudo su to root). On the Bourne Again Shell (/bin/bash), I can edit /var/root/.bash_profile. But with the Bourne Shell (/bin/sh), what script do I edit for that?

Best Answer

This answer comes close to answering the question, but I need to start using sudo su - instead of sudo su in order to switch from regular user to root or the /var/root/.profile script won't execute.

Now, unless Apple changes this, regular users by default will get the Bash shell, instead of the Bourne shell, which is unlike the root user. So, for those users, simply editing ~/.bash_profile will work fine.