In Linux we have /home/<user>/bin to put special binaries that only that user will execute, and also, the user doesn't need root permissions to put them there.

Do we have any similar thing OS X?

We have /usr/bin, but as a regular user we need root permissions to place a file there, and I'm not looking for a folder like that.

1 Answer 1


In Linux we have /home/<user>/bin to put special binaries that only that user will execute

This is not standard Linux. Under Linux, or Unix-like systems such as OS X, you can have a directory for executables anywhere you want, as long as:

  • it is in your $PATH
  • the partition it's on allows execution of files (see the noexec option for mounting file systems)

Simply create /Users/your-username/bin and add it to PATH – you're done. See: What are PATH and other environment variables, and how can I set or use them?

You can also create /usr/local/bin, then run sudo chown -R /usr/local to have it owned by your account. This directory is not used by default in OS X, and the Filesystem Hierarchy Standard recommends it as a place to put software installed by the administrator. If you're the only admin user of that machine, that works pretty well.

  • I follow your first advice, thanks @slhck for the tip. I personally don't like the idea to put custom files into global folders instead of puting in user folders, this is because I think you're creating a bad habit. No matter you're the only one that uses the machine, when you go to server you will replicate this bad habit automatically. My two cents.
    – alexserver
    Sep 18, 2013 at 19:22
  • It depends on the use case. The Filesystem Hierarchy Standard is a standard for a reason – you don't create bad habits if you follow it. It's actually the other way 'round. That being said, if you share your system with multiple users and don't want to share binaries with those users, of course your home directory is where you want to put them.
    – slhck
    Sep 18, 2013 at 19:43
  • But where on a Mac do you set $PATH? There is no equiv for .bashrc that I can see. Mar 28 at 22:29
  • @PeterFlynn It's the same, except that macOS uses login shells by default, so .bash_profile is used instead of .bashrc. See apple.stackexchange.com/questions/51036/… — also, macOS uses path_helper on top of what you can configure in your shell. See man path_helper.
    – slhck
    Mar 29 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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