2

I recently installed an IDE into /opt (I know that some recommend putting software into /usr/local but this was entirely self-contained) because the application was not available in my ditro's repositories and I had to install it from a .sh file.

The application runs fine when launching from the terminal; however, I would like to run it without having to declare the path to executable each time. I use Rofi as my application launcher but when I search for my IDE, it is not found(probably because I installed it without using a package manager - don't understand the reasons behind this behavior though).

How can I get this application that I installed to /opt to be searchable by an application launcher like Dmenu or Rofi?

2

1. $PATH

PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files (i.e., ready-to-run programs) in response to commands issued by a user.

Since I decided to install software into '/opt', I had to make sure that '/opt' was listed in PATH; it was not. I amended the '/etc/profile' file with

:/opt

at the end of the PATH variable. Note: editing '/etc/profile' will affect all users on the system, you should use the file in your home directory if you just want it changed for that specific user.

2. Symlink

Symbolic links are like shortcuts or references to the actual file or directory. Most of the time these links are transparent when working with them through other programs... Symbolic links are used all the time to link libraries and make sure files are in consistent places without moving or copying the original.

Amending the $PATH variable only addressed part of the problem. Adding /opt to the $PATH variable only added that directory and not the specific application located inside. I also needed to create a symbolic link - or symlink - in the /opt directory to the specific application so it was searchable in my application launcher.

ln -s /opt/applicationFolder/executable /opt/applicationName

This creates a symlink for the the executable located in '/opt/applicationFolder' in the directory '/opt/' with the name 'applicationName'. Had to logout/restart to see changes.

Resources:

  • Why not just put a symlink into a directory that is already in PATH? For example ln -s /opt/applicationFolder/executable /usr/local/bin/applicationName. That way, you do not have to modify any configuration file (that may be overwritten when updating). – Adaephon Jun 16 '17 at 9:45

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.