Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to installing application from source and just learning the best practices to do so.

I have this linux box without root access with a quite old emacs, so I downloaded the latest version and built as follows:

  • download to $HOME/SRC
  • configure and build in $HOME/BLD with --prefix=$HOME
  • make and make install

So this creates a bin folder in my home directory which is what I expected.

Now when I type emacs directly from terminal, it still opens the old one (as expected). So, I have to do ~/bin/emacs. I added this alias emacs=$HOME/bin/emacs to my .bash_profile which works. But I could have also added ~/bin to $PATH. However, not quite sure which one is recommended. And would the 2 versions of emacs work without any conflict e.g. both sharing and overwriting ~/.emacs each time a different version is opened.

Which is the best way to install new applications without root access where an older version is already present, and if the steps I followed are right.

share|improve this question
emacs is quite large. You should discuss either upgrading the existing emacs that's installed, or supporting multiple versions of emacs with your sysadmin. – bsd Mar 3 '12 at 16:30
possible duplicate of How to run my own program without specifying its path – Gilles Mar 3 '12 at 23:44
up vote 4 down vote accepted

Adjust your PATH. It simplifies execution, works as expected, and once you install more applications with your $HOME as prefix, they'll all work as expected. I'd do something like this in my RC file:


Setting LD_RUN_PATH should allow locally-install DSOs to work too.

What you've done to install emacs so far is pretty much the way it's done in multi-user environments.

Clarification: paths in Unix (and other software that use them, from DOS to TeX) work like lists of places, searched left to right. On Unix, we use colons (:) to separate the entries. If you have a PATH like /usr/local/bin:/bin:/usr/bin, and you're looking for a program called foo, these paths will be searched for, in order:

  1. /usr/local/bin/foo
  2. /bin/foo
  3. /usr/bin/foo

The first of these found is used. So, depending on where exactly you insert a directory, you can make your installed binaries ‘override’ others. Conceptually, the order of PATH is traditionally specific-to-generic or local-to-global. (of course, we often add weird paths to support self-contained third-party applications and this can break this analogy)

share|improve this answer
just to confirm, if I add $HOME/bin to my PATH, all programs installed there will take precedence over those (existing older versions) installed as root in /usr/bin and other locations in PATH? Basically does it matter to append or prepend $HOME/bin to PATH? e.g. PATH=$PATH:$HOME/bin instead of the above. And one more question, what if I want to install a newer version of the same program in $HOME/bin? I am guessing it would append the version number to the new files? – vis Mar 3 '12 at 14:04
@vis: the directories in $PATH are tested from left to right, so PATH=$HOME/bin:$PATH makes versions in $HOME/bin override the others, with PATH=$PATH:$HOME/bin, your version will only be used if no other is present. Re the new versions: usually, no version number is appended automatically. It's probably a good idea to rename the executables/directories and put symlinks in (so ~/bin/emacs is a symlink to ~/bin/emacs-26.3.1 which is the executable that make install called emacs). – Ulrich Schwarz Mar 3 '12 at 14:56
+1 — I updated the explanation to explain paths. – Alexios Mar 3 '12 at 16:10
Some info for completeness: /usr/bin is for binaries included with the distro / package manager. Place your own binaries in /opt or /usr/local/bin. That way a system upgrade won't risk wiping your manual binaries. – invert Mar 3 '12 at 18:49

Your Answer


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.