I have some software I am about to ship (gradschool project) and I want to know on a unix machine what the best practices are for installing software.

I originally linked through /usr/local/bin my project, but recently I looked into installing it by appending to the .bashrc file for the specific user, with the special case that if the user is root, it appends to the global path rather than user specific.

This bought me some easy functionality additions as I can quickly link to other resources with a single variable addition to the .bashrc folder of the installing user.

However, I am beginning to doubt this decision.

To append to path or not to append to path, that is the question. Whether 'tis nobler to symbolic link in /usr/local/bin, or to take arms and append to an ever growing path variable.

More information:

It's a C++ back end with a TCL front end. There is also a java archive (created much earlier in my career) that the TCL front end launches. On top of this, there is a extension of the TCL front end that plays with another program with its own TCL interpreter. I need to provide the bwidget tcl package to the program with the interpreter. So providing the bwidget package and launching the jar file necessitates having a location to link to. Further more, I need to make it easy on the users as they are primarily chemistry users and are not very familure with unix and might be on mac.

The platform nees to work on Mac or Unix.

Ideally I want the user to be able to launch the TCL script with a single command and not make them remember the location.

This is a previously closed source project that is now open source and we want users to be able to easily compile and install the program

I am using make to create an install option.

  • Orinally posted on programmers.stackexchange.com. Someone sugessted not to mess with the user's .bashrc file. Which file can I modify to add to a path on any shell? – user_123 Mar 31 '11 at 15:52
  • 1
    Never, ever mess with .bashrc :) Villagers with torches and pitch forks will arrive at your door and force you to drink caster oil in large quantities. – Tim Post Mar 31 '11 at 16:01
  • @Tim: that's "castor oil" :-). And you'd be lucky if that is all they make you do. Young people today, I tell you... – Faheem Mitha Mar 31 '11 at 16:03
  • Good to know, well there goes that idea. Where else might I append to the PATH so that it saves over X sessions? – user_123 Mar 31 '11 at 16:09
  • @Chris: Suggestion. If this is now open source, put it on some hosting site and point to it. (Most hosting sites allow you to quote program lines via link). That would make this discussion much more concrete and useful. – Faheem Mitha Mar 31 '11 at 17:40

Don't symlink to either /usr/local/bin or mess with PATH. Particularly not the latter. Just write an installation program that installs stuff to a specified location. Check a similar, preferably well-known program for how it does stuff. If you can provide more details of your program, we could offer some concrete advice if you want it.

Also, nobody writes installation programs from scratch. People customarily use programs like Make, Cmake, scons etc. And some languages have specialist installation software like distutils for python, if you want to use it.

  • @Chris: If you want to make it easy on the users, I suggest creating binary packages. What OS is this? The binary packaging would normally call the basic installation scripts (makefile, whatever). – Faheem Mitha Mar 31 '11 at 16:10
  • @Chris: Ok. update your answer, don't stick this in comments. – Faheem Mitha Mar 31 '11 at 16:14
  • @Chris: note it is also possible for users to build binary packages from the packaging, though this is not commonly done. – Faheem Mitha Mar 31 '11 at 16:15
  • So if you don't want either to happen, how do you recommend the user install and be able to easily launch? I am using a makefile, and I cannot link a jar file, i.e. java must have the actual location of the jar file not a link, and I definitely don't feel right about copying an entire jar file to the \usr\local\bin – user_123 Mar 31 '11 at 16:44

I've seen packages (usually stuff you wouldn't find on a distro's package repositories) that install themselves to /opt and add .desktop files to ~/Desktop and ~/.local/share/applications to launch them.


Two alternate suggestions:

  1. On Red Hat-like systems, you can drop a file in /etc/profile.d/myprogram.sh
    e.g. containing PATH=$PATH:/opt/myprogram
  2. On many systems, you could append your PATH=... line to /etc/environment

But I think installing your program to /opt/myprogram and putting a single script to launch it in /usr/local/bin might be the lesser evil.


I thought it is crystal clear, but judging from other answer, it seems not -- so, do NOT write any installation program. Prepare package(s) for installation and let the installation manager (which is present in most of Linux/Unix systems) do the job.

Yes, it means you should create several packages, but it shouldn't be that hard nowadays, there are multibuilders now, which create all needed packages for you, for example: http://en.opensuse.org/Portal:Build_Service

And one more remark: package should be installed silently, don't display any splash screens, settings, EULA, and so on.

  • "do NOT write any installation program" is a bit ambiguous. You do want an installation program. You want the package build system to call it to build the packages. – Faheem Mitha Apr 2 '11 at 6:44

If you want to install the program for a single user, you can put the binary executable in ~/bin. The .bashrc on most UNIX systems is set to include ~/bin on the user's path if it exists.

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.