I made a post earlier today regarding the title, but it is not actually the
solution to this issue, basically the LSP package for nim doesn't start and
spits out an error saying `Nimlangserver failed to start:Nim not in Path`. I
thought I had found the solution by changing the symlink for the sublime
package on my OS.
Basically Nimlangserver starts when you run `subl` from the terminal but not
when you click the desktop icon. This actually has to do with how the PATH
variables are used by programs it seems.
AI eventually helped me solve the issue:
**Terminal Environment:** When you run Sublime Text from the terminal, it
inherits the environment variables, including PATH, from the terminal session.
This means it has access to the PATH configured in your shell configuration
files (like .bashrc, .zshrc, etc.), which includes the path to Nim.
Yes, modifying `/etc/profile` can help ensure that the PATH is set correctly
for all users and applications, including those launched from the GUI. Here's
how you can do it:
### Editing `/etc/profile`
1. **Open `/etc/profile` in a text editor with root privileges.** For
example, you can use `nano` or `vim`:
sudo nano /etc/profile
Run
2. **Add the path to Nim at the end of the file.** You can do this by
appending the following line:
export PATH=/home/yourusername/.nimble/bin:$PATH
Run
Make sure to replace `/home/yourusername/.nimble/bin` with the actual path to
the Nim binaries on your system.
3. **Save the file and exit the text editor.**
4. **Apply the changes.** You can do this by either logging out and logging
back in or by running:
source /etc/profile
Run
### Explanation
* **`/etc/profile`** is executed by the system at login for all users. By
adding your path here, you ensure that the environment variable `PATH` is
correctly set for all login sessions, including those for GUI applications
launched from the desktop and not just your bash shell session.
This approach helps make sure that Nim is available in the PATH for all
applications, not just those started from a terminal. If you still encounter
issues, ensure that the path to Nim is correctly specified and that there are
no syntax errors in the file.